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

Bernhard Berger berber at tzi.de
Sun Oct 31 14:57:37 EDT 2010


Good evening,

Am Sat, 30 Oct 2010 17:32:50 -0600
John Jorgensen <jorgnsn at lcd.uregina.ca> wrote:

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

John already gave the correct answers and I just want to add the links
to the JVM spec. The name of the method is defined in §3.9 of the
JVM spec [1] and the content of the method is defined in §5.5 [2]. The
invocation time is exactly defined in §2.17.4 [3] with some additional
information in §2.17.5 [4].

Bernhard


[1]
http://java.sun.com/docs/books/jvms/second_edition/html/Overview.doc.html#16270

[2]
http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#77976

[3]
http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#19075

[4]
http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#24237


More information about the Soot-list mailing list