[Soot-list] Bug with AnnotationGenerator

Hal Hildebrand hal.hildebrand at gmail.com
Wed Aug 11 12:05:50 EDT 2010


Cool.  Thx.  

I thought about it a bit more, and I think that because of the signature design, there should likely be a check to see if the trailing ";" already exists.  Something like:


		annotationName = "L" + annotationName.replace('.','/');
		if (!annotationName.endsWith(";")) {
			annotationName += ";";
		}

Otherwise, I suspect some usages of the method would wind up with an erroneous trailing ";;".


BTW, is it possible to also get the fix in for emitting source annotations from the baf JasminClass?  The fix I use is to insert the following two lines at the very beginning of the soot.baf.JasminClass.emitInst(Inst) method:

    	LineNumberTag lnTag = (LineNumberTag) inst.getTag("LineNumberTag");
    	if(lnTag != null) emit(".line " + lnTag.getLineNumber());

Which seems to get the job done.

On Aug 11, 2010, at 12:06 AM, Eric Bodden wrote:

> Thanks for the fix!
> 
> I have committed the patch in revision 3549.
> 
> Eric
> 
> --
> Dr. Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
> 
> 
> 
> On 11 August 2010 02:13, Hal Hildebrand <hal.hildebrand at gmail.com> wrote:
>> 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('.','/') + ';';
>> 
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> 
>> 



More information about the Soot-list mailing list