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

Eric Bodden eric.bodden at ec-spride.de
Wed Oct 10 01:09:02 EDT 2012


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
> 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


More information about the Soot-list mailing list