1 Reply Latest reply on Apr 2, 2009 2:28 AM by keren finkel

    Can JavaAssist change a static final field?

    keren finkel Newbie

      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 = ....;
      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.