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

junit 4.12 is incompatible with cucumber-junit 1.2.0 #1083

Closed
henrik242 opened this issue Feb 19, 2015 · 19 comments
Closed

junit 4.12 is incompatible with cucumber-junit 1.2.0 #1083

henrik242 opened this issue Feb 19, 2015 · 19 comments

Comments

@henrik242
Copy link

PublicClassValidator throws an Exception with message:
"The class cucumber.runtime.junit.ExamplesRunner is not public."

junit 4.12 is incompatible with cucumber-junit 1.2.0, see http://stackoverflow.com/a/25540276/13365 and https://groups.google.com/d/msg/cukes/w1QhqqqvJ8M/F9Pjoxe6Xb0J

@henrik242 henrik242 changed the title cucumber-junit 1.2.0 is incompatible with junit 4.12 junit 4.12 is incompatible with cucumber-junit 1.2.0 Feb 19, 2015
@henrik242
Copy link
Author

Solved in cucumber-junit 1.2.2, see cucumber/cucumber-jvm#836

@kcooney kcooney reopened this Feb 19, 2015
@kcooney
Copy link
Member

kcooney commented Feb 19, 2015

I think we should consider fixing this in a 4.12.x release (and adding the validation check back in 5.0)

@marcphilipp
Copy link
Member

For reference, the commit that added this validation was 1d97da7.

@kcooney Were test classes ever allowed/supposed to be non-public or was this working more or less accidentally in 4.11 and before?

@marcphilipp
Copy link
Member

For reference, the pull requests that introduced this check was #866.

@kcooney
Copy link
Member

kcooney commented Feb 19, 2015

Looking at the stacktrace, I think it is the runner that wasn't public in Cucumber. i don't know why Cucumber worked before.

@marcphilipp
Copy link
Member

So, can we close this issue again?

@kcooney
Copy link
Member

kcooney commented Feb 21, 2015

While they fixed it on their end, we did commit a change that broke existing code in a minor release. It's possible some people can't upgrade cucumber, so they are forced to downgrade JUnit. So I think we should consider a bug fix release

@marcphilipp
Copy link
Member

IMHO we do not need to ship a fix for code that shouldn't have worked in the first place.

@junit-team/junit-committers What are your opinions on this?

@dsaff
Copy link
Member

dsaff commented Mar 2, 2015

So was Cucumber using reflection-based visibility hoisting to get at private classes, and we weren't blocking them before, but now we are?

If that's an accurate summary, then we're in a bit of a quandry; I've always publicly maintained that JUnit needs reflectively-accessed members to be public (because we don't want to require tests to be run under a security manager that's OK with visibility hoisting). On the other hand, I don't know that that expectation was in the documentation with enough clarity that we can just say "cucumber's fault". Thoughts?

@kcooney
Copy link
Member

kcooney commented Mar 2, 2015

Not sure what Cucumber was doing; someone should check. Without that knowledge, it is hard to say whether they had code that shouldn't have worked.

Assuming David is right, I feel that just because the classes in JUnit require annotated fields and classes to be public doesn't mean that third-party extensions should be required to do the same. Also, in this case, the affected users didn't write the problematic code. So I am slightly leaning toward fixing this in a 4.12.x release, not having a 4.13 release, and breaking it in 5.0.

@dsaff
Copy link
Member

dsaff commented Mar 2, 2015

What would a fix look like? Cucumber is extending the JUnit Suite runner. There was a bug (IMHO) where the Suite runner wasn't consistently checking to be sure it was attached to a public class. That bug was fixed. Would a fix consist of going back and allowing Suite to be attached to private classes?

@kcooney
Copy link
Member

kcooney commented Mar 2, 2015

I am suggesting that we would roll back the part of the change that added this particular validation. We would do that on a new branch that we don't merge to master (unless we do decide to release a 4.13 release)

@dsaff
Copy link
Member

dsaff commented Mar 2, 2015

@kcooney, OK, SGTM.

@marcphilipp
Copy link
Member

If we want to do this, we should do it soon, shouldn't we? @kcooney Do you have time to take care of it?

@kcooney
Copy link
Member

kcooney commented Mar 15, 2015

@marcphilipp I can look at this in about a week. I'd also like to fix this issue if I have the time: http://stackoverflow.com/q/27420675/95725

@marcphilipp
Copy link
Member

@marcphilipp
Copy link
Member

@kcooney Any news on this issue?

@kcooney
Copy link
Member

kcooney commented May 30, 2015

@marcphilipp sorry, haven't found time to follow through on this

@marcphilipp marcphilipp added this to the 4.13 milestone Jul 9, 2015
@kcooney
Copy link
Member

kcooney commented Aug 6, 2017

This was fixed in a58d459

@kcooney kcooney closed this as completed Aug 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants