JMH does not correctly handle Enum params that override toString()
Aleksey Shipilev
shade at redhat.com
Sun Dec 24 15:54:37 UTC 2017
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
Thanks,
-Aleksey
More information about the jmh-dev
mailing list