-
Notifications
You must be signed in to change notification settings - Fork 356
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
Support for Java 9 #1224
Comments
Half a year ago I worked a bit on this: https://github.com/eisop/checker-framework |
Thank you. Do I get this right that annotated JDK 9 is currently non-existent? |
That's correct. Many of the existing JDK annotations would transfer over, though the rearrangement of packages/modules makes that a bit harder than when upgrading from (say) JDK 7 to JDK 8. |
Since this still isn't fixed, I'm going to have to disable Checker Framework on my project. 😢 |
No timeline for JDK9 support: see typetools/checker-framework#1224
JDK 9 (and soon 10) support would be very useful. |
I agree. It's an important issue for us. If you wish to help, we would welcome assistance. |
As a work around a possibility is to keep the framework enabled for jdk8, and disable it for jdk9, using maven profiles. See my pom.xml: SERG-Delft/jpacman-framework@6894f59#diff-600376dffeb79835ede4a0b285078036 |
This is a mess. Half of these changes aren't necessary. And this breaks due to a JDK 9 internal API change. See also typetools/checker-framework#1224
This is a mess. Half of these changes aren't necessary. And this breaks due to a JDK 9 internal API change. See also typetools/checker-framework#1224
What must be updated for Checker to support Java 9 and/or 10? Is there any large-scale ETA? 1 month, 3 months, 6 months…? Will Checker then be able to work on multiple Java versions (possibly via a multi-release jar), or just one? |
We are currently working with a Google Summer of Code student to finish the Java 9 migration. We do not want to maintain multiple versions of the Checker Framework compiler infrastructure. Please let us know if you want to help with this effort! |
Interested in helping. |
The version at https://github.com/eisop/checker-framework passes all unit tests: https://travis-ci.org/eisop/checker-framework The big blocker currently is producing a version of the annotated JDK that works with Java 9+. @mernst is working on this. |
I tried to use it with our custom checker but I run into the following error:
I'm using Java 11 here - not Java 1, of course ;-) The test seems to be too strict at |
@ahubold I've pushed several changes that now allow me to build with JDK 8, 9, 10, and 11! It was quite a bit more than just this version check, as several APIs changed over the different versions. All tests pass with JDK 8. For the others the big issue is adding a side-channel for the annotated JDK; however, also a few other things where we interact with the compiler broke, e.g. some expression parsing with packages isn't working right now. Please take a look and let me know how well this works for you: |
@wmdietl Thank you! That already looks quite good. I still got an error when building the Checker Framework with Oracle OpenJDK 11.0.2. I was able to build it with Java 8 and test with Java 11 then. This was the build error with Java 11, in case you're interested:
The tests for our custom checker run successfully with Java 11 now 👍 , so I tried to run the checker on our source code and it works! 👍 Except for one subtle case: It throws an error for the following complicated code. This error wasn't thrown with Java 8 and previous versions of the Checker Framework. (I've reduced the example, so the code doesn't really make sense anymore):
The error is:
I haven't checked if there's a bug in our checker or if this is a general problem. Maybe this is one of the "few other things" that are still open? Anyway, it's easy to workaround by extracting
We're really looking forward to a CF release that supports Java 11. If the work on the annotated JDK still takes some time, maybe it's an option to build a beta release without that support? Thank you and keep up the good work! 👍 |
@ahubold Thanks for testing!
|
Yes, works for me. Thank you. |
This is a mess. Half of these changes aren't necessary. And this breaks due to a JDK 9 internal API change. See also typetools/checker-framework#1224
What are you thinking about the beta release? We had to deactivate our checker-framework related validation tasks because it does not work with Java 11. We would use the beta just to turn on the validation again. |
Sorry about the delay on this. I'll try to get to #2294 and then I can make a release of the |
Do you have an ETA for this? Will there be any limitations for the initial rollout of this? (e.g., Nullness, Lock, & Index Checkers not working) If Nullness, Lock, & Index Checkers (or any other optional functionality) are holding this back, could you release a version (possibly an alpha or beta) that works on Java 9 for most functionality, and later add support the optional functionality? What Java versions will be supported besides 9? 8, 10, 11, 12, etc.? Thanks. |
Supporting JDK 11 will greatly expand the pool of potential beta testers. JDK 9 and 10 account for only about 1 in 9 Docker downloads, and less than 1 in 700 standalone downloads, at AdoptOpenJDK (one of the few trusted sources that even builds those versions anymore). |
I made a release of artifacts that should work with Java 9 to 12: Sources for this version continue to be at https://github.com/eisop/checker-framework The Java 12 preview switch expressions are not supported, tracked at #2373 . For simplicity, I didn't include the One big caveat is that the annotated JDK also contains side-effect information. Without this, flow-sensitive refinement will be a bit coarser. Stub files can still be used to provide such information. Contributions are always very welcome. |
I tried the io.github.eisop:*:3.0.0-b1 release with Java 11 but ran into some issues and did not get it to work with our custom checker. The Maven POMs have some errors in their dependencies, which I could work around:
I was then able to compile our custom checker and start its tests (based on framework-test), but got an exception
which is related to a cast of the system class loader to URLClassLoader, which does not work in Java 9 anymore, see for example https://blog.codefx.org/java/java-9-migration-guide/#Casting-To-URL-Class-Loader The code just tries to output an error, so I debugged into the code and the original error is
org/checkerframework/dataflow/analysis/Analysis is not contained in framework-all but seems to be required for a custom type system. I added a dependency to io.github.eisop:dataflow:3.0.0-b1 then, which has wrong group ids for its dependencies, so I had to exclude its org.checkerframework:checker-qual and org.checkerframework:javacutil dependencies. I then got the next error
This class was part of the checker.jar (at least in 2.5.7) but I cannot find it in the io.github.eisop release. So I had to give up here. @wmdietl Maybe the stripped |
@ahubold Thanks a lot for your detailed investigation and sorry for the serious mistakes in that first release. There is also a small example using the Value Checker: https://github.com/eisop/checker-framework/tree/master/docs/examples/MavenExample-framework-all I also release all artifacts under Thanks again for the feedback and please let me know if this one works better. |
@wmdietl Thank you. The io.github.eisop:framework-test still has a transitive dependency to org.checkerframework:checker-qual (wrong groupId) of even different versions as reported by the dependencyConvergence report of the Maven enforcer plugin. But I can simply exclude that dependency.
Our tests now always show the following error:
The tested class does not have an explicit constructor in the Java source. I'm not quite sure what this means but the behavior seems to have changed here with eisop@04b377e and broke our custom checker. It used to work with Checker Framework 2.5.7. In our type system, we have the qualifier |
Thanks for testing!
So overall this sounds like things are working as expected. |
wrt 1) You're probably right. I didn't notice the different versions when using the org.checkerframework artifacts because in that case I'd manage the version of checker-qual myself in my project. This just popped up because of the different groupId io.github.eisop wrt 2) Yes, this really seems to be unrelated. Sadly, even after overriding the mentioned method, our checker reports more false positives. I still need to check that, but will take the discussion elsewhere, if needed. Yes, I'm using Java 11. I cannot say if it really works now, because I'm still unable to run our checker on our code base - because of the changed behavior of the framework. |
The transitive dependency problem will be fixed in the next release of the org.checkerframework artifacts. @wmdietl should be able to use the same fix for the io.github.eisop artifacts. Thanks for the report! checker-framework/maven-artifacts/release/javacutilReleasePom.xml Lines 37 to 50 in c57933b
|
is there any ETA, or anticipated release version, for Java 9 support? How much additional work will be required to support Java 10, 11, 12, 13, etc.? |
Version 3.0.0 will support Java 11. (Java 9 isn't supported by Oracle any more.) If you are willing to help with testing or other tasks, we would gratefully accept assistance. |
I haven’t really used Checker that much, so I’m probably not the best person to test it; I was waiting for current Java version support & hopefully improved tooling support, possibly through common annotations. If I get a chance to try it soon, I’ll let you know if I run into any issues. |
If you wait for common annotations, you may wait for years. |
Lacking annotations for the nullness and initialization checkers probably makes the pool of potential testers very small. For me, those were the entire use case for Checker Framework, and custom checkers are a solution in search of a problem. |
|
Support for JDK 9+ was added in 3.0.0 release of the Checker Framework. JDK annotations for Java 11 are included in checker.jar, too. |
As far as I understand, there is no support for upcoming Java 9 as of now. Is this on the roadmap? Or maybe there are workarounds to get going with JDK 9?
The text was updated successfully, but these errors were encountered: