[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static field constant initializers



> I'm just reading from the JVM spec. It says a field can have a
> "ConstantValue" attribute, which must be applied at class initialization
> time before any static initializers are executed. So it seems a
> different compiler could choose to use "ConstantValue" instead of
> creating a "hidden" static initializer; if so, Soot would break if
> such a compiler were used to generate the class files.

As far as I know, Soot does not currently handle these ConstantValue
attributes. However, coffi (the part of Soot that loads classes) seems
to support them, so I don't think it would be too hard to pass the
information up from coffi into a SootField. I would suggest looking
in for uses of soot/src/soot/coffi/ConstantValue_attribute.java and
in soot/src/soot/coffi/Util.java. I don't know of anyone working on
adding support for this; I'll integrate a patch if someone sends
me one.

> Also.. any word on when "LineNumber" attributes will be supported?

As far as I know, the LineNumber are supported in the current version
with the following switch (see
http://www.sable.mcgill.ca/soot/tutorial/usage/):

-A LineNumber, --annotation LineNumber
Preserves the line number tables of class files through transformations.

Ondrej