RFR: CODETOOLS-7902929: JMH generators fail for benchmark in unnamed package
Aleksey Shipilev
shade at openjdk.java.net
Mon May 10 13:29:54 UTC 2021
On Mon, 10 May 2021 07:09:48 GMT, Jason Zaugg <jzaugg at openjdk.org> wrote:
>> Prior to the patch, the enclosed test failed with:
>>
>>
>> $ mvn -Preflection test
>> ...
>> Running UnnamedPackageTest
>> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec <<< FAILURE! - in UnnamedPackageTest
>> compileTest(UnnamedPackageTest) Time elapsed: 0.004 sec <<< FAILURE!
>> java.lang.AssertionError: Annotation generator had thrown the exception.:
>> java.lang.NullPointerException
>> at org.junit.Assert.fail(Assert.java:89)
>> at org.junit.Assert.assertTrue(Assert.java:42)
>> at UnnamedPackageTest.compileTest(UnnamedPackageTest.java:55)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
>> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>
> jmh-core-ct/src/test/java/UnnamedPackageTest.java line 56:
>
>> 54: String error = destination.getErrors().get(0);
>> 55: Assert.assertTrue(error, error.contains("Benchmark class should have package other than default."));
>> 56: }
>
> If you want to keep this test, I'm happy to refactor this, e.g. to take the expected message into an overload of `CompileTest.assertFail` .
Yes, we need to keep the test. There is `CompileTest.assertFail(Class<?> klass, String error)`, just use that?
-------------
PR: https://git.openjdk.java.net/jmh/pull/38
More information about the jmh-dev
mailing list