[Checkers] Problems with binary distribution of JSR 308 and Checker Framework
Michael Ernst
mernst at csail.mit.edu
Mon Jun 2 07:54:53 EDT 2008
I'm having trouble building and running the binary version of the Checker
Framework distribution (downloaded from our website). I resolved a couple
of problems, but more remain. This is a serious problem: it means that
people who want to use our tools are stymied and may not come back. (I
know that I have lost users here in Germany because the system would not
build and they didn't want to waste any more of their time. I really don't
want this to happen any more.)
1. I couldn't get "ant all-tests" to run unless I edited the value of
compiler.lib in ~/jsr308/checkers/build.properties. Is there a better fix?
In any event, some change to the distribution must be made so that "ant
all-tests" runs for users who have downloaded the binary distribution (as
we recommend).
2. I couldn't get any annotation processor at all to run from the command
line, using our instructions. I was able to fix this by adding tools.jar
to the classpath (which our instructions did not mention). I have added
this to the instructions; is that the right fix?
3. I am getting the same error that multiple others have reported:
NoSuchMethodError: javax.annotation.processing.Messager.printMessage
This is obviously not due to a misconfiguration, given that this is at
least the third report we have received. You have added a new signature to
the Messager interface:
void printMessage(Diagnostic.Kind kind, CharSequence msg, Tree t,
CompilationUnitTree root);
That signature does appear in Messager.class in both tools.jar (where it's
new: it does not appear in the Sun-distributed version that appears in my
directory, after installation, as tools.jar.save) and javac.jar. However,
that file claims to have been compiled from JavacMessager.java. There is a
different Messager.class in ~/jsr308/jdk1.7.0/jre/lib/rt.jar; it is the
interface and lacks the new signature. Could the fact that
~/jsr308/jdk1.7.0/jre/lib/rt.jar has not been updated be part of the
problem?
Could you look into the problem, or let me know what I should do to give you
more information?
Below are commands that I executed, as a brand new user with no
customizations. I also gave some indication of where things went wrong.
-Mike
rm -rf ~/jsr308
mkdir ~/jsr308
cd ~/jsr308
wget http://www.java.net/download/jdk7/binaries/jdk-7-ea-bin-b27-linux-i586-22_may_2008.bin
chmod +x jdk-7-ea-bin-b27-linux-i586-22_may_2008.bin
./jdk-7-ea-bin-b27-linux-i586-22_may_2008.bin
export JAVA_HOME=$HOME/jsr308/jdk1.7.0
export PATH=$JAVA_HOME/bin:$PATH
cd ~/jsr308
wget http://groups.csail.mit.edu/pag/jsr308/releases/jsr308-langtools.zip
unzip jsr308-langtools.zip
cd langtools/binary
ant install
javac -version
cd ~/jsr308
wget http://groups.csail.mit.edu/pag/jsr308/releases/jsr308-checkers.zip
unzip jsr308-checkers.zip
## I didn't do this yet.
# export CLASSPATH=${CLASSPATH}:$HOME/jsr308/checkers/checkers.jar
## 1. PROBLEM with "ant all-tests"
# Edit ~/jsr308/checkers/build.properties like so:
# compiler.lib=../langtools/binary/javac.jar
ant all-tests
## 2. PROBLEM apparently due to missing tools.jar:
javac -typeprocessor checkers.nonnull.NonNullChecker examples/NonNullExample.java
# error: Annotation processor 'checkers.nonnull.NonNullChecker' not found
export CLASSPATH=.:$HOME/jsr308/checkers/checkers.jar
javac -typeprocessor checkers.nonnull.NonNullChecker examples/NonNullExample.java
# An exception has occurred in the compiler (1.7.0-jsr308-0.6.2). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
export CLASSPATH=.:$HOME/jsr308/jdk1.7.0/lib/tools.jar:$HOME/jsr308/checkers/checkers.jar
javac -typeprocessor checkers.nonnull.NonNullChecker examples/NonNullExample.java
# No problems. Therefore, I have changed the manual to indicate that this
# should be added to CLASSPATH as well.
## 3. PROBLEM with printMessage not being found.
export CLASSPATH=.:$HOME/jsr308/jdk1.7.0/lib/tools.jar:$HOME/jsr308/checkers/checkers.jar
javac -typeprocessor checkers.nonnull.NonNullChecker examples/NonNullExampleWithWarnings.java
# An annotation processor threw an uncaught exception.
# Consult the following stack trace for details.
# java.lang.NoSuchMethodError: javax.annotation.processing.Messager.printMessage(Ljavax/tools/Diagnostic$Kind;Ljava/lang/CharSequence;Lcom/sun/source/tree/Tree;Lcom/sun/source/tree/CompilationUnitTree;)V
# at checkers.source.SourceChecker.message(SourceChecker.java:242)
# at checkers.source.SourceChecker.report(SourceChecker.java:364)
# at checkers.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:649)
# at checkers.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:612)
# at checkers.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:593)
# at checkers.basetype.BaseTypeVisitor.visitAssignment(BaseTypeVisitor.java:124)
# at com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1463)
# at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
# at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:107)
# at com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:239)
# at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1155)
# at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
# at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:107)
# at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
# at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
# at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:159)
# at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
# at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
# at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:107)
# at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
# at com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:143)
# at checkers.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:229)
# at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:681)
# at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
# at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:107)
# at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
# at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
# at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:98)
# at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:132)
# at checkers.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:139)
# at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:604)
# at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:49)
# at checkers.source.SourceChecker.process(SourceChecker.java:191)
# at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:733)
# at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:662)
# at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:807)
# at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:995)
# at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:741)
# at com.sun.tools.javac.main.Main.compile(Main.java:380)
# at com.sun.tools.javac.main.Main.compile(Main.java:306)
# at com.sun.tools.javac.main.Main.compile(Main.java:297)
# at com.sun.tools.javac.Main.compile(Main.java:82)
# at com.sun.tools.javac.Main.main(Main.java:67)
More information about the checkers
mailing list