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

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


On Mon, 15 Mar 2021 11:16:41 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> 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.
>
> Right. There are also three other places where these casts happen, grep for `new BenchmarkTaskResult` in the same file. I would also need to check how to regression-test this...

Yes, I see them.
I'll try to see what happens if I simply add the -Werror to the entire build, that is essentially what happens in my project.
Note: I have submitted the OCA this morning; apparently this takes time.

> Looks good. Once you have OCA approved, bot would lift `oca` tag, and then instruct you to say `/integrate`. We can ping @robilad to see if there are problems with OCA.

It has been 'open' for several days. 
So I resubmitted the OCA just now.
@robilad It it good now?

> jmh-core/src/test/java/org/openjdk/jmh/util/TestListStatistics.java line 253:
> 
>> 251:         Assert.assertEquals(Double.NaN, s.getConfidenceIntervalAt(0.50)[1], 0.0000001);
>> 252:         Assert.assertEquals(Double.NaN, s.getPercentile(0), 0.0000001);
>> 253:         Assert.assertEquals(Double.NaN, s.getPercentile(100), 0.0000001);
> 
> Please introduce the `static final double ACCURACY = 0.0000001`, and use it?

Done in all places.

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

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


More information about the jmh-dev mailing list