[Checkers] ClassWriter bug report

Mahmood Ali mahmood at MIT.EDU
Wed Jun 18 20:47:15 EDT 2008


Hi Matt,

I have been working on having the Checker Framework parse annotations  
from class files.  Unfortunately, I couldn't make much progress.

I suspect that there is a bug in ClassWriter that prevents it from  
writing all type annotations to the classfile.  When debugging (using  
the latest version), I noticed that for the method testParam(), I was  
getting the following:

- method - testParam - MethodSymbol.typeAnnotations has one element:  
<[UNKNOWN @-1]>
- parameter - m - VarSymbol.typeAnnotations is List.nil() i.e. empty  
list

I was suspecting a different result.  Shouldn't one of them have an  
annotation for parameterized type?

Here is the output when using -X308 flags.  Notice how it printed a  
statement for the method receiver when writing and reading, but not  
for the parameterized type.

> mahmood-mac:bin mahmood$ javac -version
> javac 1.7.0-jsr308-0.6.2
> mahmood-mac:bin mahmood$ javac -X308:writer -cp ~/checkers.jar  
> Test.java
> writing @checkers.interning.quals.PolyInterned at [METHOD_RECEIVER  
> @-1]
> mahmood-mac:bin mahmood$ javac -X308:reader -cp ~/checkers.jar:.  
> UseTest.java
> reading: @checkers.interning.quals.PolyInterned/*proxy*/{} @  
> [METHOD_RECEIVER @-1]
> reading: adding <[METHOD_RECEIVER @-1]  
> @checkers.interning.quals.PolyInterned> to symbol m1()
> mahmood-mac:bin mahmood$
> mahmood-mac:bin mahmood$
> mahmood-mac:bin mahmood$ cat Test.java
> import checkers.interning.quals.*;
> import java.util.*;
>
> public class Test {
>     // Test parameter
>     void m1() @PolyInterned { }
>
>     void testParam(List<@Interned String> m) {
>     }
> }
> mahmood-mac:bin mahmood$ cat UseTest.java
> public class UseTest {
>     Test t = null;
> }

I tested with 0.6.2, which is the last release before updating  
langtools to hg.

Please send me an email with your thoughts.

Regards,
Mahmood


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/mailman/private/checkers/attachments/20080618/823c55a6/attachment.htm 


More information about the checkers mailing list