On Sat, 7 Mar 2026 00:01:41 GMT, Chen Liang <[email protected]> wrote:

> In the Java Platform, most bootstrap method declarations are declared in Java 
> source code. Each of these bootstrap method need to refer to the bootstrap 
> method mechanism, which makes documentation repetitive, and not 
> straightforward when seen from source code. This demand came out of recent PR 
> reviews like #30067.
> 
> We can introduce documented annotations so the bootstrap method role becomes 
> straightforward. The Java compilers can also emit warnings for these 
> annotations to make sure the annotated declarations are not definitely 
> illegal.
> 
> In this RFE, javac will provide basic warnings under the new "bsm" lint 
> category to validate these annotations for source levels 27 and above. The 
> lint category will be on by default, and won't affect `-Xlint:all` usages for 
> source levels 26 and below.

Also, since this is a new public API, I think it could be good to add some 
examples of valid bootstrap method declarations to the javadoc. JDK developers 
can just look for examples in the JDK source code, but for external users that 
may not be so easy.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/30125#issuecomment-4050704850

Reply via email to