JMH does not correctly handle Enum params that override toString()
Aleksey Shipilev
shade at redhat.com
Sun Dec 24 15:57:46 UTC 2017
On 12/24/2017 04:54 PM, Aleksey Shipilev wrote:
> On 12/24/2017 04:48 PM, Anuraag Agrawal wrote:
>> Instead, name() should be used when round-tripping through valueOf is
>> required
>>
>> https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html#name()
>>
>> This affects the reflection and ASM generators. Annotation processor is
>> unaffected since it directly reads the declaration token.
>
> That makes sense.
>
>> The patch is simple and I've attached it,
>
> Patch got stripped :( Please put it inline?
>
>> but could not find any tests that
>> round-trip reflection/ASM benchmarks from compile -> run (the issue only
>> affects running a benchmark, the compile succeeds). if this patch makes
>> sense, any advice on writing a regression test would be appreciated.
>
> Run the build with appropriate profile, and the tests would run with appropriate generator:
>
> $ mvn clean install -Pasm
> $ mvn clean install -Preflection
Ah, also make the regression test that trips on this issue, and run with some profile above. Our CI
runs all tests with all profiles, so that would be a valid regression test. Since this is runtime
failure, put the test somewhere in jmh-core-it.
Thanks,
-Aleksey
More information about the jmh-dev
mailing list