RFR: 7903596: JMH: Explicitly enable annotation processors [v3]
Aleksey Shipilev
shade at openjdk.org
Fri Dec 6 06:56:52 UTC 2024
On Fri, 6 Dec 2024 02:08:31 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Can I please get a review of this change which proposes to address the issue noted in https://bugs.openjdk.org/browse/CODETOOLS-7903596?
>>
>> As noted in that issue, when a benchmark generated using Java 22 is run, at runtime it fails with:
>>
>>
>> java -jar target/benchmarks.jar
>> Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
>> at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:98)
>> at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:124)
>> at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:252)
>> at org.openjdk.jmh.runner.Runner.run(Runner.java:208)
>> at org.openjdk.jmh.Main.main(Main.java:71)
>>
>>
>> This is due to annotation processors being disabled by default during compilation starting Java 22. The commit in this PR, explicitly enables the `org.openjdk.jmh.generators.BenchmarkProcessor` annotation processor to allow for it to generate the necessary benchmark resources.
>>
>> I've tested this change locally, with Java 8, Java 21 as well as Java 22 and the newly generated benchmark is now functional on all these versions.
>
> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>
> Contributed-by Aleksey: Explicitly apply the annotation processor
Thanks! Please fix the following nit and merge from master to get cleaner macos runs.
jmh-archetypes/jmh-java-benchmark-archetype/src/main/resources/archetype-resources/pom.xml line 94:
> 92: <arg>-processor</arg>
> 93: <arg>org.openjdk.jmh.generators.BenchmarkProcessor</arg>
> 94: </compilerArgs>
Forgot to mention this: this should probably be using `<annotationProcessors>` as well, like the other hunks.
-------------
PR Review: https://git.openjdk.org/jmh/pull/125#pullrequestreview-2483788762
PR Review Comment: https://git.openjdk.org/jmh/pull/125#discussion_r1872687165
More information about the jmh-dev
mailing list