-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix bug on JDK 9 #1507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug on JDK 9 #1507
Conversation
601d6e2 to
7f66629
Compare
| //Java < 9: | ||
| equalTo(asList("methodA", "methodB", "methodC")), | ||
| //Java >= 9 has annotations on methods of java.lang.Object: | ||
| equalTo(asList("clone", "finalize", "getClass", "hashCode", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest ignoring the jdk.internal.* annotations completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I understand your motivation I would like to keep it like it is, because the implemented method does nothing wrong. The test has a wrong assumption about the class. IMHO the problem here is that the test is not good enough. I write a better test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Alex. The tests would be less.fragile if you filtered out the jdk.internal.* annotations. They are, after all, internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote the tests so that they are less fragile. Therefore I don't have to change getAnnotatedMethods by adding a filter.
JDK 9 uses classes from the package jdk.internal.reflect instead of sun.reflect.
Use same coding style within TestClassTest.
Make the test less fragile. The number of annotated methods varies because Java 9 introduces new annotations for some methods of Object.
Make the test providesAnnotatedMethodsSortedByName less fragile. (Before the test failed on JDK 9 because Java 9 introduces new annotations for some methods of Object.)
Developers with a current JDK 9 on their machines are currently not able to easily build JUnit. This commit makes it possible to develop with JDK 9 and ensures that JUnit can be build with JDK 0.
No description provided.