[Soot-list] Bug with AnnotationGenerator

Hal Hildebrand hal.hildebrand at gmail.com
Tue Aug 10 20:13:39 EDT 2010


I'm using the AnnotationGenerator to add annotations to my methods and noticed that the resulting annotation type has the trailing ";" missing.  In the class files, compiled with the Java compiler, these annotations have the trailing ";".  I have just confirmed that when I load the generated classes (from Soot, using the added annotations via AnnotationGenerator), I get:

java.lang.reflect.GenericSignatureFormatError
	at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
	at sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:262)
	at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270)
	at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244)
	at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228)
	at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
	at sun.reflect.generics.parser.SignatureParser.parseTypeSig(SignatureParser.java:157)
	at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:367)
	at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:181)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
	at java.lang.reflect.Method.declaredAnnotations(Method.java:693)
	at java.lang.reflect.Method.getAnnotation(Method.java:679)
	at com.hellblazer.primeMover.soot.TestContinuationAnalysis.testAnalysis(TestContinuationAnalysis.java:98)

Which, I'm pretty sure, means that the annotation should have the trailing ";" is required.

The fix is to replace line 147 in soot.jimple.toolkits.annotation.j5anno.AnnotationGenerator with:

		annotationName = "L" + annotationName.replace('.','/') + ';';

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100810/35ba34ed/attachment.html 


More information about the Soot-list mailing list