RFR: CODETOOLS-7902853: JMH: Fix lint and deprecation warnings

Niels Basjes github.com+240096+nielsbasjes at openjdk.java.net
Tue Mar 23 20:20:53 UTC 2021


In my projects I always use -Werror as the compiler flag as one of the means to get a high standard for code quality.
In this project https://github.com/nielsbasjes/yauaa I have a module that does the benchmarks.
When I update the JMH from 1.26 to 1.28 my build fails with 
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /home/nbasjes/workspace/Prive/yauaa_/benchmarks/target/generated-sources/annotations/nl/basjes/parse/useragent/benchmarks/jmh_generated/AnalyzerBenchmarks_android6Chrome46_jmhTest.java:[324,67] redundant cast to long
[WARNING] /home/nbasjes/workspace/Prive/yauaa_/benchmarks/target/generated-sources/annotations/nl/basjes/parse/useragent/benchmarks/jmh_generated/AnalyzerBenchmarks_android6Chrome46_jmhTest.java:[324,83] redundant cast to long
[WARNING] /home/nbasjes/workspace/Prive/yauaa_/benchmarks/target/generated-sources/annotations/nl/basjes/parse/useragent/benchmarks/jmh_generated/AnalyzerBenchmarks_androidPhone_jmhTest.java:[324,67] redundant cast to long
[WARNING] /home/nbasjes/workspace/Prive/yauaa_/benchmarks/target/generated-sources/annotations/nl/basjes/parse/useragent/benchmarks/jmh_generated/AnalyzerBenchmarks_androidPhone_jmhTest.java:[324,83] redundant cast to long
and at the end it fails
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/nbasjes/workspace/Prive/yauaa_/benchmarks/target/generated-sources/annotations/nl/basjes/parse/useragent/benchmarks/jmh_generated/AnalyzerBenchmarks_android6Chrome46_jmhTest.java: warnings found and -Werror specified
[INFO] 1 error

Turns out this problem is caused by a change in code generated by JMH.

This pull request fixes this problem.

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

Commit messages:
 - Fix junit.framework deprecation warnings
 - Set stricter compiler options during compile tests
 - Fix 'redundant cast to long' in generated code

Changes: https://git.openjdk.java.net/jmh/pull/31/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jmh&pr=31&range=00
  Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902853
  Stats: 272 lines in 109 files changed: 50 ins; 0 del; 222 mod
  Patch: https://git.openjdk.java.net/jmh/pull/31.diff
  Fetch: git fetch https://git.openjdk.java.net/jmh pull/31/head:pull/31

PR: https://git.openjdk.java.net/jmh/pull/31


More information about the jmh-dev mailing list