[Checkers] Compiling FreePastry and javax.annotation.processing.Messager

Matt Papi mpapi at csail.mit.edu
Sat Mar 1 14:09:36 EST 2008


Mike,

I had some trouble with the FreePastry instructions that you'd sent me 
last week, so I modified the "interned" target in build.xml to look like 
this (and I shared them with Mahmood, so I believe he's using something 
similar):

   <target name="interned" depends="clean,init">
     <javac srcdir="${src.dir}"
            destdir="${build.dir}"
            classpathref="project.classpath"
            includes="**/*.java"
            deprecation="no"
            debuglevel="lines,vars,source"
            fork="yes"
            executable="$annotations/langtools/dist/bin/javac"
            debug="true">
       <compilerarg line="-version"/>
       <compilerarg line="-processor checkers.interned.InternedChecker"/>
     </javac>


Note the addition of the "executable" and "fork" attributes, which cause 
Ant to use an external javac; you'll need to edit $annotations for the 
"executable" attribute accordingly.

This works because the javac script prepends the JSR 308 javac.jar to 
the bootclasspath. You can do this in Ant via a "bootclasspath" 
attribute, but I found this way to be more reliable.

- Matt

Michael Ernst wrote:
> Mahmood-
> 
>> I was just able to compile free pastry and daikon using the Interned  
>> and IGJ framework.
> 
> That's great; thanks.
> 
> I'm having trouble compiling FreePastry.  In particular, I can't figure out
> how to make javac use the correct version of class
> javax.annotation.processing.Messager .  Below is my output.  Can you tell
> me exactly how you are compiling, so I can avoid this problem?
> 
>                      Thanks,
> 
>                     -Mike
> 
> 
> 
> swsmde 24% ant -e interned
> Buildfile: build.xml
> 
> clean:
> Deleting directory /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/classes
> 
> init:
> Created dir: /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/classes
> 
> interned:
> Compiling 666 source files to /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/classes
> /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/src/rice/p2p/util/XMLObjectInputStream.java:109: warning: sun.reflect.ReflectionFactory is Sun proprietary API and may be removed in a future release
>   protected ReflectionFactory reflFactory = (ReflectionFactory) AccessController.doPrivileged(new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
>             ^
> /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/src/rice/p2p/util/XMLObjectInputStream.java:109: warning: sun.reflect.ReflectionFactory is Sun proprietary API and may be removed in a future release
>   protected ReflectionFactory reflFactory = (ReflectionFactory) AccessController.doPrivileged(new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
>                                              ^
> /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/src/rice/p2p/util/XMLObjectInputStream.java:109: warning: sun.reflect.ReflectionFactory is Sun proprietary API and may be removed in a future release
>   protected ReflectionFactory reflFactory = (ReflectionFactory) AccessController.doPrivileged(new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
>                                                                                                              ^
> 
> 
> 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:245)
> 	at checkers.source.SourceChecker.report(SourceChecker.java:367)
> 	at checkers.interned.InternedVisitor.visitBinary(InternedVisitor.java:61)
> 	at checkers.interned.InternedVisitor.visitBinary(InternedVisitor.java:28)
> 	at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1561)
> 	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
> 	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.visitMethodInvocation(TreeScanner.java:267)
> 	at checkers.basetype.BaseTypeVisitor.visitMethodInvocation(BaseTypeVisitor.java:207)
> 	at checkers.interned.InternedVisitor.visitMethodInvocation(InternedVisitor.java:91)
> 	at checkers.interned.InternedVisitor.visitMethodInvocation(InternedVisitor.java:28)
> 	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1315)
> 	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
> 	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 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 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:153)
> 	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:681)
> 	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
> 	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 com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:604)
> 	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
> 	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.visitCompilationUnit(TreeScanner.java:119)
> 	at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:488)
> 	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
> 	at checkers.source.SourceChecker.process(SourceChecker.java:194)
> 	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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:623)
> 	at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:55)
> 	at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
> 	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
> 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
> 	at org.apache.tools.ant.Task.perform(Task.java:364)
> 	at org.apache.tools.ant.Target.execute(Target.java:341)
> 	at org.apache.tools.ant.Target.performTasks(Target.java:369)
> 	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
> 	at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
> 	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
> 	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> 	at org.apache.tools.ant.Main.runBuild(Main.java:668)
> 	at org.apache.tools.ant.Main.startAnt(Main.java:187)
> 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
> 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> 
> BUILD FAILED
> /DS/home-0/mernst/tmp/try-freepastry/pastry-2.1alpha3/build.xml:88: Compile failed; see the compiler error output for details.
> 
> Total time: 14 seconds
> swsmde 25% jwhich javax.annotation.processing.Messager
> 
> Class 'javax.annotation.processing.Messager' found in 
> 'file:/DS/home-0/mernst/java/jdk1.7.0-b24/jre/lib/rt.jar!/javax/annotation/processing/Messager.class'
> 
> Classpath:
> /DS/home-0/mernst/research/typequals/annotations/checkers/checkers.jar
> /DS/home-0/mernst/research/typequals/annotations/langtools/dist/lib/javac.jar
> /DS/home-0/mernst/research/invariants/java
> /DS/home-0/mernst/research/invariants/java/lib/bcel.jar
> /DS/home-0/mernst/research/invariants/java/lib/commons-io.jar
> /DS/home-0/mernst/research/invariants/java/lib/java-getopt.jar
> /DS/home-0/mernst/research/invariants/java/lib/junit.jar
> /DS/home-0/mernst/java
> .
> /usr/share/ant/lib/ant.jar
> /DS/home-0/mernst/java/tagsoup-1.2.jar
> /DS/home-0/mernst/java/jdk/jre/lib/rt.jar
> /DS/home-0/mernst/java/jdk/lib/tools.jar
> /DS/home-0/mernst/research/fcut/edu.mit.lcs.pag.fdanalysis.vfs/src
> swsmde 26% 
> 
> _______________________________________________
> checkers mailing list
> checkers at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/checkers




More information about the checkers mailing list