JMH and JDK9

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Mar 30 16:20:29 UTC 2016


On 03/30/2016 07:12 PM, Alan Bateman wrote:
> On 30/03/2016 17:09, Andrew Haley wrote:
>> I'm totally stuck trying to use jmh to test my JDK9 code.  I can't
>> build JMH itself with JDK9 because I get a weird error in some Eclipse
>> classes in Maven.  So, I've tried to run Maven with JDK8 but use a
>>
>> error: Annotation generator had thrown the exception.
>> java.lang.NoClassDefFoundError: javax/annotation/Generated
>>
>> My guess is that this has something to do with modules, but I don't
>> know that for sure.  I need to compile my test code against JDK9
>> because the methods I'm testing do not exist in JDK8.
>>
>> Is there a recipe for using JMH with JDK9 classes?  What do people do?
>>
> There is discussion on this in this bug:
>   https://bugs.openjdk.java.net/browse/JDK-8152842
> 
> but in the mean-time it looks like JMH no longer uses @Generated.

Yeah, hold on, Andrew! Jigsaw-enabled JMH is coming this week.

Meanwhile, there are workarounds:
 a) Compile with JDK 9 EA b110; (not b111)
 b) Checkout and build JMH 1.12-SNAPSHOT (see instructions on JMH page);

-Aleksey




More information about the hotspot-dev mailing list