Null pointer check elimination
Chris Gray
chris.gray@kiffer.be
Sat Nov 12 21:21:00 GMT 2005
Another way to look at functions which return 'this' (and there are plenty of
those in the core Java libraries) is that
sb = new StringBuffer(foo).append(foo).append(bar)
is equivalent to
sb = new StringBuffer(foo); sb.append(bar); sb.append(baz);
in which it is quite obvious that sb never becomes null. So maybe just
special-casing 'return this' could yield optimisations without having to mess
with new type variants. etc..
--
Chris Gray /k/ Embedded Java Solutions BE0503765045
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
chris.gray@kiffer.be +32 3 216 0369
More information about the Java
mailing list