[jboss-user] [Javassist user questions] - Can JavaAssist change a static final field?

kfinkels do-not-reply at jboss.com
Wed Apr 1 06:24:36 EDT 2009


Hi,
I'm using ClassFile.renameClass as in jbossretro in order to replace instances of a class in a jar to my own class.
This is what I wants to achieve:
Some classes are using class A:
public class A {
....
}
I've created a new class AA:
public class AA extends A{
....(overwrite some methods)
}

I want to replace the A instances with AA in the jar.
In the jar I have class B as follows:

public class B {
....
private final A a = ....;
....
}
But...
I cannot replace the final fields. 
I've looked at JBosRetro - when replacing the StringBuilder with JBossStringBuilder - they have the same bug. final field referring to StringBuilder are not replaceable. Is there a way to replace the final declaration - I'm working on the bytecode.
10x,
Keren

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222568#4222568

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222568



More information about the jboss-user mailing list