"Provided" scope (was: @GenerateNativeHeader)

Jesse Glick jesse.glick at oracle.com
Wed May 23 08:48:19 PDT 2012


On 05/23/2012 07:38 AM, Alan Bateman wrote:
> also brings up the topic of dependencies that have scope

I guess this case would be similar to what Maven offers with <scope>provided</scope>: included in compiler classpath but not expected to be available at runtime (nor 
packed in WEB-INF/lib/*.jar, nor loaded during unit tests, etc.). Such a feature in Jigsaw would be very handy for using annotations (*) and/or (non-Enum) compile-time 
constants, especially if javac verified that your usage of the dependency was in fact limited to these language features that cannot cause a NoClassDefFoundError.

module-info.class should make no mention of the dependency, so I guess these should not be in module-info.java (**). In other words, you would need to pass some new 
option TBD to javac:

$ javac -provided findbugsAnnotations at 2.0.0 mymodule/src


(*) RetentionPolicy.RUNTIME annotations are probably OK - they will behave like CLASS retention in this case, but that is presumably what you wanted.

(**) According to its apparent current design, which is just a readable form of module-info.class, not a description of source code or compiler instructions except 
insofar as these things happen to be inferable from runtime metadata.



More information about the jigsaw-dev mailing list