-
Notifications
You must be signed in to change notification settings - Fork 59
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
withObjectMocked leads to "java.lang.NoSuchFieldException: modifiers" #350
Comments
Our CI tests Scala 2.11, 2.12 & 2.13 on both Java 8 & 11, so it should work... |
I believe that original poster is running the tests with a bigger java version than 8, this is a problem I am facing for java 14, but not when i pass java 8 to sbt through -java-home command |
I guess it could be worth adding CI on Java 14 or 15 to avoid this kind of issues in the future |
More info on the issue: See: |
* getField for java 12+ * Fix for java 13+, avoid type conversion error Co-authored-by: Alberto Lago <[email protected]>
@trompa thanks a lot for the fix, will add CI on 13+ versions soon! |
Unfortunately, it wasn complete, need to apply the same fix to setFinalStatic, working on it |
No prob, mind adding a newer Java version here? |
* getField for java 12+ * Fix for java 13+, avoid type conversion error * Fix the right method * undo allchanges * undo allchanges * remove unused import * sync upstream and apply changes Co-authored-by: Alberto Lago <[email protected]> [skip ci]
I'm still seeing this issue with java8, scala 2.11, and mockito-scala-scalatest 1.16.46.
I'm using the code from the example in the readme
Thank you. |
Will have a look |
I'm seeing this using Java 8, Scala 2.12, mockito v1.17.0. |
temporary... it work for me!!
|
It's very interesting, but https://github.com/mockito/mockito-scala#mocking-scala-object says
If object is declared inside a class or method, run fails with exception :/ JDK: 1.8.0_382 |
facing the same issue. seems related: https://stackoverflow.com/questions/56039341/get-declared-fields-of-java-lang-reflect-fields-in-jdk12 |
Same issue |
I'm using java 8 and scala 2.12.
Is
withObjectMocked
supported in Java 8?The text was updated successfully, but these errors were encountered: