RFR (S) 8073550 : java* tools: replace obj.getClass hacks with Assert.checkNonNull or Objects.requireNonNull

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Feb 26 00:43:11 UTC 2015

On 02/25/2015 04:25 PM, Maurizio Cimadamore wrote:
>> 3. In general, we should not depend on the javac internal Assert 
>> mechanism outside of javac.
> Uh - ok. Not sure I fully buy this - i.e. javadoc reuses 99% of javac 
> so I'm not sure what buys us not to use Assert mechanism there...

The com.sun.tools.classfile library is currently stand-alone, totally 
separate from javac. It has even been backported into JDK 6.   It seems 
wrong/unnecessary to introduce a new dependency on a minor javac utility 

In separate, somewhat unrelated discussions, we have talked about doing 
more with the javac Assert mechanism, and possibly recording more of the 
execution environment, in a somewhat more formalized way. That would 
likely depend on support code in the javac Main program, where we catch 
and handle all the exceptions that might come out of the javac 
internals. javadoc does not share/reuse that part of javac.

Separately, the ongoing cleanup of the javac doclet API (JEP 221: 
http://openjdk.java.net/jeps/221) will significantly reduce javadoc's 
need to access javac internal API. So, it's good to keep the 
dependencies down.

-- Jon

More information about the compiler-dev mailing list