-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checker not working on Java 7 #3
Comments
I'm not quite ready to move different project from Java 7 to Java 8 so I enabled Checker in a branch for now: pdurbin/addressbookmvc@0839841 |
I had a look and it seems to me the jdk7 Maven artifact was compiled with Java 8, therefore it won't work if you compile your project with Java 7. The error I got here was this:
Could you guys please make sure you compile the jdk7 jar with a Java 7 compiler? |
Sorry, it seems it was ME who was using Java 8's javac :( Anyway, I got to try to compile the code using javac rather than Maven and got the root error:
Clearly, the error is at |
Here's the culprit: The method does exist in OpenJDK 8's code: But not in Java 7: I confirmed with IntelliJ that Oracle's source also does not contain this method in Java 7. This is therefore a bug in the Checker Framework. Please submit a bug with them. |
My whole session, just in case you find it hard to reproduce:
|
…ramework! Only slight adaptations afterwards.
On Ubuntu: JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn package
@renatoathaydes good sleuthing. For now I left a comment for @wmdietl typetools/checker-framework@1737b00#commitcomment-12843853 This how I'm able to reproduce the bug... by compiling the application with the javac from Java 7: I just pushed a branch to test from (uses Java 7 instead of Java 8): https://github.com/pdurbin/maven-hello-world/commits/java7checker |
Hi Philip, Renato, typetools/checker-framework@1737b00#commitcomment-12844274 You should be able to use a Java 7 JVM, but you will need to use a Java 8 javac, either jsr308-langtools or the OpenJDK 8 javac. |
@wmdietl thanks! It would probably be much more straightforward for your potential users to tell them that they must use Java 8. I find "Requirement: You must have JDK 7 or later installed" at http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#installation a little misleading. Here's the line in question: I believe you that jsr308-langtools (whatever that is) helps Checker work with Java 7 but if I'd humbly suggest changing the line above to suggest that new users start with Java 8 since Java 7 is EOL these days anyway. |
There are still many of our users that depend on Java 7. If you follow the instructions you cite, you can successfully and without hassle use the Checker Framework with Java 7. |
@wmdietl already the section about Maven indicates that Java 8 should be used. Or at least it suggests it with 1.8 specified for the maven-compiler-plugin: http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#maven . The Maven section doesn't say anything about Java 7 or jsr308-langtools (though the Ant section mentions "Set the jsr308javac property".) Anyway, it seems like a hassle to use Checker with Java 7 and Maven. That's fine. We should all be upgrading to Java 8 anyway! :) |
Using the Checker Framework as it stands is a hassle with Java 7 or Java 8, which explains why it is not being widely used (can't find any blog posts, questions about it on StackOverflow etc.). It's a pitty. To succeed, Checker should be and behave just like an annotation processor which does some static checks at compile-time, and that's what I was trying to use it as (and succeeded for the most part, but it was a hassle for sure). I will not use some unknown, slow compiler on my code. I want the nullness checks to be optional. We have lots of legacy modules which we will not use nullness checks on. I don't want to manually download and install what is basically a Java library as in pre-Maven times. And most people won't do that either, I'd think. Because that shouldn't be necessary. A little more focus on convenience would go a long way. |
@pdurbin @renatoathaydes @mernst @JonathanBurke The Checker Framework is an annotation processor and using it as such is possible. We provide scripts to make usage as convenient as possible, for the users we hear from. jsr308-langtools is a clone of Java 8u javac - it is not "some unknown, slow compiler". The slowdown is purely due to the checks the Checker Framework performs as an annotation processor. The reason to have jsr308-langtools is to support our existing users that require Java 7 compatibility - by providing support for the new type annotation syntax in comments. The nullness checks are completely optional. Can you elaborate why you think they are not? |
No trouble with Java 8 and Maven! Checker is great! I've been trying to explain it to people: http://irclog.greptilian.com/sourcefu/2015-08-31#i_135262 :) |
Cool, I'm glad it is working for you. Lots of folks report similar success. I'm hoping that Renato can explain how he came about his mistaken beliefs, so that we can improve the documentation and so that he can be successful too. Thanks in advance, Renato, for helping us help you. |
Well, I created the project which makes Maven and Java8 work well together (this is a fork of that). The guide in the current documentation tells me I have to download Checker, when that really shouldn't be the case, and I have an open PR which changes the guide to make it easier (though not easy still) for people. My beliefs are not mistaken in any way, it is a hassle to use Checker. My colleagues think I'm crazy for even trying. IF you don't see that, then you seem to be the one with mistaken beliefs. Using an annotation processor should consist of:
My PR almost achieves that... we still need to go through hoops to get the annotated JDK's path given to the compiler (which is more a fault of Maven than Checker, admittedly) If you want to help me, merge my PR, fix the problems you guys raised with it (really minor ones but I've been too busy lately) and try to make it even easier by not requiring the annotated JDK path (I've already suggested in another thread you should use stubs instead, but I was dismissed), please. EDIT I've been trying to help you make your project attractive to professional developers who would otherwise just ignore your project as soon as they see how it relies on installation of local files and relative paths to find things to be used. Any non-academic/non-single-person project will have a build that runs on dozens of machines where you can't just install things that are not part of the toolchain and use relative paths to connect them. If you, like me, think the Checker Framework can be useful for professionals, and is not just an academic exercise, try to accept my criticism constructively. I don't need help with anything, I have everything I need working beautifully, as always :) I don't benefit in any way by pointing out issues I see with Checker and solutions to try to make it better. But I do so anyway because I believe it's worth it in this case. If you think what you're doing is perfect and anyone criticising obviously has mistaken beliefs, then good luck with that attitude, but I hope that's not the case. |
I do hope that @mernst and @wmdietl appreciate where @renatoathaydes is coming from. I really appreciate the work he's done in typetools/checker-framework#461 and https://github.com/renatoathaydes/checker-maven-demo . It has inspired me to play with Checker more. Perhaps some day I'll try to introduce it to my team. @mernst maybe you can elaborate on what you mean by "mistaken beliefs." |
Renato, we do appreciate all your help and the effort you have put in. I've said it before and I will say it again: Thanks! I completely accept that the Maven integration must be improved because it is currently a hassle to use. We appreciate your help with it. As you point out, some of the problems are due to Maven itself, some due to our requirement to support Java 7, and some due to the current poor status of our existing Maven support. I agree that in principle all Java users ought to move to Java 8, but we have many commercial users who are stuck on Java 7 and any solution needs to work for them too. That's why we cannot accept a solution that only works for Java 8. Our roadmap has us requiring Java 8 in April 2016. The beliefs I was referring to were "I will not use some unknown, slow compiler on my code. I want the nullness checks to be optional." Werner specifically asked about both of these, but I didn't see an answer to his questions. For example, could you tell us why you believe the nullness checks are not optional, so that we can improve the documentation? Thanks again for your help. |
@mernst thanks for your kind words about @renatoathaydes and clarifying which questions are unanswered. |
@pdurbin The current Checker Framework release (version 1.9.8) includes new Maven instructions that are supposed to work with both Java 7 and Java 8 (though you do have to edit your Maven build file to switch between Java 7 and Java 8). Can you check whether they work for you and this issue can be closed? |
Checker is working great with Java 8 (see 3c08628) but I can't get it working with Java 7.
Locally I made the following change to the pom.xml to switch from Java 8 to Java 7...
... but it's not working. I'm getting this error:
The text was updated successfully, but these errors were encountered: