Skip to content
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

Merged
merged 1 commit into from
Jan 22, 2017

Conversation

kcooney
Copy link
Member

@kcooney kcooney commented Jan 17, 2017

This is one possible fix for #1411
The other possible fix is #1412

@kcooney kcooney force-pushed the ignore-bridge-methods branch from 5c3287d to 01d0b44 Compare January 17, 2017 05:36
@kcooney kcooney merged commit d066f52 into junit-team:master Jan 22, 2017
@@ -149,6 +149,11 @@ public boolean isShadowedBy(FrameworkMethod other) {
}

@Override
boolean isBridgeMethod() {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

@kcooney kcooney Feb 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants