-
-
Notifications
You must be signed in to change notification settings - Fork 418
Error in running the zerocode tests in JDK23/21 #704
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
Comments
first timer trying to work on contributing. can I get the assignment? can I get more info? Tests are failing with JDK21,23 when lower JDKs are all successful? |
@thanasissot , lower lower JDKs are all successful. This is very much evident from the latest CI builds. You can have a look at the last CI runs here.
Let me know if you think you can still proceed with the fix, then we can assign the issue to you. |
Is anyone currently working on this issue? If not, I'd be happy to take it on |
Hello @rkampani , noone seems picked up yet. Thanks for your interest. Assigned to you now. You can proceed please. My suggestion would be to try it locally first, once you get an idea of the problem and the fix, then raise a PR with changing the Java version here(Line No.20). |
@rkampani I tried messing around a little bit, but eventually never replied in the thread. One thing I found trying to research on a random error from using JDK 21 and running mvn test is that it comes from mockito-core which is used by the juckito dependency for tests. I tried updating mockito-core through dependency management and the specific error I was looking into was fixed. I assume the requirement is to only use a newer JDK to build, run and pass all tests - don't update the projects source code version used aka 1.8 -> 21. @authorjapps I would love some info/discussion/feedback on this - even a short answer. This is a valuable experience for me even If I don't get to practically contribute. @rkampani Does my approach sound a good start? What is your strategy for approaching this issue? Again I would appreciate knowledge sharing for experience. |
Thanks @thanasissot, Great findings.
This is interesting. Can we use another library? We should have the Test coverage, than using "juckito" :) |
Hey @thanasissot, thanks! AFAIK, You were spot on —The issue stems from changes introduced newer JDK , where Java has tightened encapsulation and access control on internal fields of platform classes such as java.util.Optional. Specifically, we're seeing the error: Failed making field 'java.util.Optional#value' accessible when running tests using Jukito — a testing framework that combines JUnit and Guice — on JDK 21.0.6 or 23.0.1. This problem is triggered by Gson attempting to reflectively access the private value field inside Optional, which is now restricted by newer JDK versions. However, Jukito’s reliance on an older version of Mockito added some additional complexity. To address this, we had a few options:
I went with Option 1 (custom TypeAdapter),— which provides as it offers a clean solution with minimal code refactoring : ) . I also made sure to exclude any conflicting mockito dependencies to avoid potential version issues. I've opened a draft PR for now ——I remember you had shown interest in this request earlier, so if you'd like, feel free to take a look and build on top of it. Once you’ve pushed the final changes, we can go ahead and clean up the draft. Don’t hesitate to reach out if you need any support — I’m happy to help! |
Both @rkampani and @thanasissot have been added as collaborators here: |
Observed the following error in running the tests in higher version of JDK(21.0.6 and JDK(23.0.1).
Appreciate if anyone can provide the fix.
The text was updated successfully, but these errors were encountered: