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

Daniel Wainwright daniel at libwebsite.so
Tue Oct 9 01:23:33 EDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20121009/bde6d877/attachment.html 


More information about the Soot-list mailing list