On Thu, 12 Mar 2026 22:29:20 GMT, Jorn Vernee <[email protected]> wrote:
>> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 12 additional >> commits since the last revision: >> >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/javac-bsm-validate >> - Joe review, ap warnings >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/javac-bsm-validate >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/javac-bsm-validate >> - Years >> - Updates >> - Copyright >> - Merge branch 'master' of https://github.com/openjdk/jdk into >> feature/javac-bsm-validate >> - More fixes >> - Fixed error hiding >> - ... and 2 more: https://git.openjdk.org/jdk/compare/3b2deef7...8554cb81 > > test/langtools/tools/javac/meth/BootstrapAnnos/BadBootstrapAnnotations.out > line 6: > >> 4: BadBootstrapAnnotations.java:23:5: compiler.warn.not.bootstrap.method: >> kindname.method, BadBootstrapAnnotations(), (compiler.misc.dynamic.constant) >> 5: BadBootstrapAnnotations.java:27:5: compiler.warn.not.bootstrap.method: >> kindname.method, >> nonStaticBoot(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.invoke.MethodType), >> (compiler.misc.dynamic.call.site) >> 6: BadBootstrapAnnotations.java:27:24: compiler.warn.not.bootstrap.method: >> kindname.method, >> nonStaticBoot(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.invoke.MethodType), >> (compiler.misc.dynamic.constant) > > So we do throw warnings for instance methods? The javadoc on the annotation > seems to imply that instance methods are alright, or does the receiver have > to be MethodHandles.Lookup? Yes, we do. Technically if an instance method on `MethodHandles.Lookup` takes `String, MethodType` we can make it a BSM. Unfortunately `MethodHandles.classData` was not declared this way so we couldn't verify easily. > test/langtools/tools/javac/meth/BootstrapAnnos/GoodBootstrapAnnotations.java > line 68: > >> 66: // weird condys >> 67: @ConstantBootstrap static void constNull(MethodHandles.Lookup l, >> Object... o) {} >> 68: } > > Could you add a 'good' example of instance bootstrap method as well? This requires you to patch MethodHandles, and I wonder whether any patching would quickly go out of sync with the actual code... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30125#discussion_r2928094379 PR Review Comment: https://git.openjdk.org/jdk/pull/30125#discussion_r2928090347
