RFR: 7903321: Use a set instead of a map to record methods in class 'MethodGroup' [v2]
Guoxiong Li
gli at openjdk.org
Wed Sep 21 11:17:07 UTC 2022
On Wed, 21 Sep 2022 11:04:25 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Simplify the method 'addMethod'.
>
> jmh-core/src/main/java/org/openjdk/jmh/generators/core/MethodGroup.java line 78:
>
>> 76: throw new GenerationException(
>> 77: "@" + Benchmark.class.getSimpleName() + " method is duplicate with " +
>> 78: mi.method.getQualifiedName() + ". JMH needs an uniquely named method, regardless of the arguments list. ",
>
> Aha! Now I remember why it was `Map` -- we needed `exist` here. But we can also simplify the diagnostics. Say, for example:
>
>
> throw new GenerationException(
> "Duplicate @" + Benchmark.class.getSimpleName() + " method name: " +
> mi.method.getQualifiedName() + ". JMH needs an uniquely named method, regardless of the arguments list. ",
>
>
> This would probably need test adjustments that might expect different error message.
I found a corresponding test case `jmh-core-ct/src/test/java/org/openjdk/jmh/ct/benchmark/args/ArgumentListAmbiguityTest`. Any other test cases do you think need to be adjusted?
-------------
PR: https://git.openjdk.org/jmh/pull/79
More information about the jmh-dev
mailing list