RFR: 7903596: JMH: Explicitly enable annotation processors [v4]
Jaikiran Pai
jpai at openjdk.org
Fri Dec 6 07:06:30 UTC 2024
> 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 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 five additional commits since the last revision:
- replace compilerArgs with annotationProcessors in maven-compiler-plugin
- merge latest from master branch
- Contributed-by Aleksey: Explicitly apply the annotation processor
- merge latest from master branch
- 7903596: jmh-java-benchmark-archetype generated benchmark fails at runtime - ERROR: Unable to find the resource: /META-INF/BenchmarkList
-------------
Changes:
- all: https://git.openjdk.org/jmh/pull/125/files
- new: https://git.openjdk.org/jmh/pull/125/files/2c402960..d443aa71
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jmh&pr=125&range=03
- incr: https://webrevs.openjdk.org/?repo=jmh&pr=125&range=02-03
Stats: 42 lines in 8 files changed: 8 ins; 18 del; 16 mod
Patch: https://git.openjdk.org/jmh/pull/125.diff
Fetch: git fetch https://git.openjdk.org/jmh.git pull/125/head:pull/125
PR: https://git.openjdk.org/jmh/pull/125
More information about the jmh-dev
mailing list