[Checkers] Exception in checker's API

Mahmood Ali mahmood at MIT.EDU
Thu Sep 4 15:50:15 EDT 2008


Greetings Artemus,

Unfortunately, I cannot replicate your finding when only using the  
provided snippets.  Can you please send me your UniqueList code?

Regards,
Mahmood

On Sep 4, 2008, at 3:10 PM, Artemus Harper wrote:

> I am getting an illegal argument: LOCAL_VARIABLE in  
> TypeFromElement.annotate method which is invoked as a result of  
> calling AnnotatedTypeFactory.methodFromUse.
> Part of the processed file:
>         @Unique("{T}") UniqueList<String> list = new  
> UniqueList<String>();
>         @Unique String s1 = new String("s1");
>         list.add( (@Unique String) s1); //<--- this line
>
> where list.add is:
>     public synchronized void add(@Unique("T") T item) @NoEscape
>     {
>         ensureCapasity(size + 1);
>         items.set(size++, (@Unique("T") T) item);
>     }
>
> I only get this error when I invoke add from a different source file.
>
> Stack trace:
> Caused by: java.lang.IllegalArgumentException: illegal argument:  
> LOCAL_VARIABLE
>     at checkers.types.TypeFromElement.annotate(TypeFromElement.java: 
> 98)
>     at  
> checkers 
> .types.AnnotatedTypeFactory.fromElement(AnnotatedTypeFactory.java:248)
>     at  
> checkers 
> .types 
> .AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:146)
>     at  
> checkers.types.AnnotatedTypes.asMemberOfImpl(AnnotatedTypes.java:272)
>     at checkers.types.AnnotatedTypes.asMemberOf(AnnotatedTypes.java: 
> 239)
>     at checkers.types.TypeFromTree 
> $TypeFromExpression.visitIdentifier(TypeFromTree.java:154)
>     at checkers.types.TypeFromTree 
> $TypeFromExpression.visitIdentifier(TypeFromTree.java:58)
>     at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java: 
> 1698)
>     at  
> com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
>     at  
> checkers 
> .types 
> .AnnotatedTypeFactory.fromTreeWithVisitor(AnnotatedTypeFactory.java: 
> 355)
>     at  
> checkers 
> .types.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java: 
> 306)
>     at  
> checkers 
> .types 
> .AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:193)
>     at  
> checkers 
> .types 
> .AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:735)
>     at  
> checkers 
> .types.AnnotatedTypeFactory.getReceiver(AnnotatedTypeFactory.java:601)
>     at  
> checkers 
> .escape 
> .EscapeAnnotatedTypeFactory 
> .methodFromUse(EscapeAnnotatedTypeFactory.java:199) <-- I get this  
> error even when I don't override this method
>     at  
> checkers 
> .basetype.BaseTypeVisitor.visitMethodInvocation(BaseTypeVisitor.java: 
> 266)
>     at com.sun.tools.javac.tree.JCTree 
> $JCMethodInvocation.accept(JCTree.java:1312)
>     at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java: 
> 67)
>     at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java: 
> 110)
>     at  
> com 
> .sun 
> .source.util.TreeScanner.visitExpressionStatement(TreeScanner.java: 
> 239)
>     at com.sun.tools.javac.tree.JCTree 
> $JCExpressionStatement.accept(JCTree.java:1152)
>     at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java: 
> 67)
>     at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java: 
> 110)
>     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:778)
>     at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java: 
> 67)
>     at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java: 
> 110)
>     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: 
> 184)
>     at com.sun.tools.javac.tree.JCTree 
> $JCMethodDecl.accept(JCTree.java:678)
>     at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java: 
> 67)
>     at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java: 
> 110)
>     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:127)
>     at com.sun.tools.javac.tree.JCTree 
> $JCClassDecl.accept(JCTree.java:601)
>     at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java: 
> 49)
>     at checkers.source.SourceChecker.process(SourceChecker.java:199)
> -- 
> Artemus Harper
> _______________________________________________
> checkers mailing list
> checkers at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/checkers




More information about the checkers mailing list