-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Ignore bridge methods when scanning for annotated methods. #1413
Conversation
5107244
to
5c3287d
Compare
5c3287d
to
01d0b44
Compare
@@ -149,6 +149,11 @@ public boolean isShadowedBy(FrameworkMethod other) { | |||
} | |||
|
|||
@Override | |||
boolean isBridgeMethod() { |
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.
@kcooney -- i found an use-case where "isBridge()" is not enough. I think, it should be widened to "isSynthetic()". See https://github.com/junit-team/junit5/compare/ignore_synthetic_methods with a test case included.
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.
JUnit4 doesn't support using @Test
, @Before
etc on anything but "normal" methods.
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.
...and JUnit 4 does not provide support tools like JUnit 5 now does.
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.
@kcooney Is the assumption correct, that every bridge method is also synthetic? Couldn't find a definitive answer to that question in the language spec or via googling, yet.
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.
@sormuras synthetic methods are any methods introduced by the compiler that do not correspond to something in the source (with the exception of default constructors and static initializers). Therefore any bridge method is a synthetic method.
This is one possible fix for #1411
The other possible fix is #1412