[Soot-list] <clinit>() method in Soot's generated XML

John Jorgensen jorgnsn at lcd.uregina.ca
Sat Oct 30 19:32:50 EDT 2010


    iqbala24> I was generating xml files from a bunch of class
    iqbala24> files. In some of the xml files, I see a method node
    iqbala24> with name = "<clinit>()". Can anybody tell me what this
    iqbala24> method correspond to ? A short example will be
    iqbala24> appreciated.

<clinit>() contains the code of the class's static initializers,
which includes initializations of static fields, as well as
blocks that appear within "static { ...}" in Java source.

I believe the static initializers are run once, some time after
the class is loaded and before any instances of it are created,
but I haven't checked the JVM spec to confirm that belief.

    iqbala24> A short example will be appreciated.

In the example class defined by the attached source, the clinit will
include the initialization of objectCount to 1, as well as the
allocation and initialization of staticStringArray.

    iqbala24> appreciated.  Also, investigating the xml files I so
    iqbala24> far came to know that there are 4 kinds of invoke to
    iqbala24> methods : staticInvoke, virtualInvoke, specialInvoke
    iqbala24> and interfaceInvoke. Can there be any other kind of
    iqbala24> invoke besides these 4 ?

I'm less certain of this, since my Soot knowledge is rusty. Java
bytecode itself has four invoke instructions, which correspond to the
four names you mention, but it is possible that some of Soot's
intermediate representations for a program might lump of the
subcategories of an invocation together.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: StaticInitializerExample.java
Url: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20101030/a7d28682/attachment.pl 


More information about the Soot-list mailing list