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
Unable to use JMock 2.6.0 with Java 8 #60
Comments
I can confirm, if I build jmock (2.7.0-SNAPSHOT) and use this instead, Java 8 build works fine. When will 2.7.0 be released? |
we have same problems. any changes? |
Also interested. What is the upgrade path for Java 8? We have 3000+ tests and I'm trying to find the least invasive way to get to a version of JMock that will support Java 8. The latest
|
I too had this problem but after looking at the code I suspect that it is an issue with the JDK 1.8 compiler. In my case the code that wouldn't compile was: oneOf(something).method(with(anything())); By adding a cast like so: oneOf(something).method(with( (Matcher<Object>)anything() ) ) ) (Change the cast to whatever your argument type is) |
... or use the new with primitive methods, e.g. |
Thanks @mread, I had some issues using parameterized types in expectations after upgrading to JDK 8: oneOf(something).method(with(any(X.class))) Started to generate a compiler error: Changing the expectation to oneOf(something).method(with.is(any(X.class))) fixed the compiler error. |
Solved in 2.8.0, in maven central now. |
Out of curiosity, tried to build an existing project (which uses 7) with Java 8 (source = 1.8, target=1.8) but I see many of these errors emitted by the Java 8 Compiler.
The text was updated successfully, but these errors were encountered: