[Soot-list] annotation bug ?
Eric Bodden
eric.bodden at mail.mcgill.ca
Sun Jun 15 12:45:09 EDT 2008
Ok there are still two things going wrong.
1.) We used to generate bytecode of version 46 but it needs to be 49
for Java 5. I fixed this in Jasmin and this generally makes
Annotations show up now. However...
2.) There seems to be a problem with parameter annotations. Right now
I get the following runtime error:
Class annotations:
>@foo.Note(ignore=true)
Field annotations:
>@foo.Note(ignore=true)
Method annotations:
>@foo.Note(ignore=true)
Parameter annotations:
Exception in thread "main" java.lang.annotation.AnnotationFormatError:
Parameter annotations don't match number of parameters
at java.lang.reflect.Method.getParameterAnnotations(Method.java:759)
at foo.Check.main(Check.java:22)
Apparently the constant pool shows a number of annotations that's
different from the actual number of annotations.
Since I am myself not that familiar with Jasmin I am not quite sure
how to fix this.
For the file compiled with javac I get the following javap output:
public void method(int);
RuntimeVisibleParameterAnnotations: length = 0xC
01 00 01 00 13 00 01 00 14 5A 00 15
Code:
Stack=0, Locals=2, Args_size=2
0: return
LineNumberTable:
line 11: 0
LocalVariableTable:
Start Length Slot Name Signature
0 1 0 this Lfoo/Simple;
0 1 1 p1 I
For the sootified file I get instead:
public void method(int);
Code:
Stack=0, Locals=2, Args_size=2
0: return
RuntimeVisibleParameterAnnotations: length = 0xD
00 01 00 01 00 0B 00 01 00 13 5A 00 07
Does anybody have a link to the exact bytecode specification for
parameter annotation attributes?
Eric
2008/6/15 Matteo Miraz <matteo.miraz at gmail.com>:
> Dear all,
>
> I need to transform an annotated class, but I have some problems...
> all annotation (including run-time ones) goes away.
> I seen the previous thread (solved here:
> http://www.sable.mcgill.ca/pipermail/soot-list/2008-April/001726.html
> ), but I think that the bug is still open (at least in the latest
> stable version and in today's nightly build).
>
> I've tried to annotate some elements with a new annotation, and then I
> tried to access them using java refection. Before transforming the
> class with soot, the annotations are present, but after a naive
> transformation (just copy everything and create a new class), the
> annotations are gone away.
>
>
> If you want, I've created a simple test project, available at:
> http://home.dei.polimi.it/miraz/research/gente/sootAnnotationBug.zip
>
> Thank you in advance,
> Matteo
>
> --
> A clever person solves a problem.
> A wise person avoids it.
> (Einstein)
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
More information about the Soot-list
mailing list