This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Null pointer check elimination


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]