Two questions about parameter nullness in the JDK

Michael Ernst mernst at cs.washington.edu
Mon Jun 2 02:40:03 UTC 2014


I have a couple of questions about places that the JDK is under-specified 
with respect to nullness properties.

Many GitHub projects pass null as the implVendor argument to 
ClassLoader.definePackage:

   
https://github.com/search?p=2&q=definePackage+packageName+null&ref=searchresults&type=Code

However, the ClassLoader.definePackage documentation does not say whether 
null is permitted or forbidden as an argument.  Could you clarify and 
document this issue?

Another example is ClassFileTransformer.transform.  It seems safe to pass 
in a null protectionDomain to the current implementation:

   https://gist.github.com/trask/d47133aef3b662b6548b

However, the documentation does not explicitly state whether null is 
permitted or forbidden.  I'd like to get a ruling on this issue so that it 
can be documented as well.

Thanks very much for your help!

                     -Mike



More information about the core-libs-dev mailing list