Can Javassist change a static final field?

Hi,
I'm using ClassFile.renameClass as in jbossretro in order to replace instances of a class in a some.jar to my own class.
This is what I wants to achieve:
Some classes in the
some.jar 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
some.jar.
In the
some.jar I have class B as follows:

public class B {
....
private final A a = ....;
....
}
But...
I cannot replace the final fields.

Hi,
I'm using ClassFile.renameClass as in jbossretro in order to replace instances of a class in a some.jar to my own class.
This is what I wants to achieve:
Some classes in the
some.jar 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
some.jar.
In the
some.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 JBossRetro - it's a tool to set bytecode compiled with java 1.5 as it was compiled with java 1.4 - when they replacing the StringBuilder with JBossStringBuilder (their own implementation)- they have the same bug. final field referring to StringBuilder are not replaceable.

Are you familiar with thoses frameworks? Is there a way to replace the final declaration - I'm working on the bytecode.
10x,
Keren

javassist - www.jboss.org/javassist

jbossretro - www.jboss.org/community/docs/DOC-10738

 

 

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com