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

Re: a bug in soot (coffi)



Hi Feng,

Feng Qian wrote:
...
testconstA.java modified
public class testconstA {
public static final z = 7;
}
The solution is to assign the value of ConstantValue attribute to a static field in <clinit> explicitly (create one if no <clinit> exists) before any other real code in original <clinit>...

So, you are saying that you want to change such a class into:


testconstA.java modified again
public class testconstA {
 public static final z;
 static {
  z = 7;
 }
}

I would really prefer that the ConstantValue attribute be preserved
instead of adding an assignment statement.  Execution of static blocks
happen at a later time than initialization of fields with ConstantValue
attributes, according to the JVM spec.  [In other words, constant fields
are initialized with their value before <clinit>() is called].

Etienne

--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/