[
http://jira.jboss.com/jira/browse/JASSIST-37?page=all ]
Vlad Skarzhevskyy updated JASSIST-37:
-------------------------------------
Workaround Description:
The problem was field.setModifiers() was not called before klass.addField(field,
initializer);
So initializer was not suppose to be created. Later filed was modified to static final.
But this does not affect initializer
Description:
I'm creating tool to verify Java API compatibility
I'm converting class files to XML and then XML to classes creating CtClass objects
that have empty implementation.
Then target is to compare new lib version to API described in XML.
project site:
http://pyx4me.com/snapshot/jour/signature.html
This is what causing the problem:
CtField field = new CtField(CtClass.longType, "test", klass);
CtField.Initializer initializer = CtField.Initializer.constant(1);
klass.addField(field, initializer);
// Then later when
Object value = field.getConstantValue();
//value is always null and can't be used for comparison.
when I call klass.writeFile(); The .class is created correctly and when decompiled I see
that int filed is properly initialized .
BUT When javassist loads again the generated classes field.getConstantValue(); still
null!
was:
I'm creating tool to verify Java API compatibility
I'm converting class files to XML and then XML to classes creating CtClass objects
that have empty implementation.
Then target is to compare new lib version to API described in XML.
project site:
http://pyx4me.com/snapshot/jour/signature.html
This is what causing the problem:
CtField field = new CtField(CtClass.longType, "test", klass);
CtField.Initializer initializer = CtField.Initializer.constant(1);
klass.addField(field, initializer);
// Then later when
Object value = field.getConstantValue();
//value is always null and can't be used for comparison.
when I call klass.writeFile(); The .class is created correctly and when decompiled I see
that int filed is properly initialized .
BUT When javassist loads again the generated classes field.getConstantValue(); still
null!
CtField.getConstantValue() for just added fileds
------------------------------------------------
Key: JASSIST-37
URL:
http://jira.jboss.com/jira/browse/JASSIST-37
Project: Javassist
Issue Type: Bug
Environment: Java 5, javassist 3.4.ga or javassist 3.6.ga
Reporter: Vlad Skarzhevskyy
Assigned To: Shigeru Chiba
Attachments: AChildClass-generated.class
I'm creating tool to verify Java API compatibility
I'm converting class files to XML and then XML to classes creating CtClass objects
that have empty implementation.
Then target is to compare new lib version to API described in XML.
project site:
http://pyx4me.com/snapshot/jour/signature.html
This is what causing the problem:
CtField field = new CtField(CtClass.longType, "test", klass);
CtField.Initializer initializer = CtField.Initializer.constant(1);
klass.addField(field, initializer);
// Then later when
Object value = field.getConstantValue();
//value is always null and can't be used for comparison.
when I call klass.writeFile(); The .class is created correctly and when decompiled I see
that int filed is properly initialized .
BUT When javassist loads again the generated classes field.getConstantValue(); still
null!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira