[Soot-list] Reference to containing class assigned before initialization

Daniel Wainwright daniel at libwebsite.so
Thu Oct 11 05:50:03 EDT 2012


Hi Eric,

Thanks for your quick response. When the Jimple is generated from the
source rather than the byte code, the init call comes before the field
assignment, so my guess is that the order is not important (unless it gets
moved around later on). In any case I will consider this as a special case
for my analysis.

Thanks,
Daniel

On Wednesday, October 10, 2012, Eric Bodden wrote:

> Hi Daniel.
>
> That's an interesting case. Indeed this never occurred to me but I
> think this should actually be correct as in the source code the
> external "this" reference is set implicitly but is certainly available
> in the inner class's super constructor. Hence I think that it actually
> *must* be set before the call to init(). Indeed an interesting case,
> though. I wonder if there's something about this in the JVM spec...
>
> Eric
>
> On 9 October 2012 07:23, Daniel Wainwright <daniel at libwebsite.so> wrote:
> > Hi,
> >
> > I have a question regarding constructors in Jimple. I had assumed that
> all
> > uses of an object in it's initializer would need to come after the call
> to
> > the super constructor, however this appears not to be the case for
> > non-static inner classes. In the example below, the field used as a link
> to
> > the containing class (this$0) is assigned before Object.<init> is called
> on
> > "this" (r0). My question is: are these references to containing objects a
> > special case, or are other uses of the class allowed before the super
> > constructor call?
> >
> >
> > In Java:
> >
> > class One {
> >     class Two {
> >     }
> > }
> >
> >
> > In Jimple (generated from class file):
> >
> > class test.One$Two extends java.lang.Object
> > {
> >     final test.One this$0;
> >
> >     void <init>(test.One)
> >     {
> >         test.One$Two r0;
> >         test.One r1;
> >
> >         r0 := @this: test.One$Two;
> >         r1 := @parameter0: test.One;
> >         r0.<test.One$Two: test.One this$0> = r1;
> >         specialinvoke r0.<java.lang.Object: void <init>()>();
> >         return;
> >     }
> > }
> >
> > The Jimple was generated with the Eclipse plugin. When I generate the
> Jimple
> > from the Java source the super constructor call does come first.
> >
> >
> > Thanks,
> > Daniel
> >
> >
> >
> >
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at sable.mcgill.ca <javascript:;>
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >
>
>
>
> --
> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
> Head of Secure Software Engineering Group at EC SPRIDE
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca <javascript:;>
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20121011/cf8c7f30/attachment.html 


More information about the Soot-list mailing list