title: Javassist - redirect field access to methods (doesn't work)
body: <p>I have the following Class</p>
  
  <pre><code>public class Booking{
  
      public String name;
      public String comment;
  
      public String session;
  
      public void test(){
          this.name = "hi";
      }
  }
  </code></pre>
  
  <p>I instrument it using the following:</p>
  
  <pre><code>cc.instrument(new ExprEditor(){
      public void edit(FieldAccess arg) throws CannotCompileException {
          if (arg.isWriter()) {
              StringBuffer code = new StringBuffer();
              code.append("$0.");
              code.append(arg.getFieldName());
              code.append("=$1.toUpperCase();");
              arg.replace(code.toString());
          }
      }           
  });
  </code></pre>
  
  <p>Now when I call this:</p>
  
  <pre><code>Booking b = new Booking();
  b.name = "hello";
  System.out.println(b.name); // Edited correction
  
  b.test();
  System.out.println(b.name);
  </code></pre>
  
  <p>Gives me</p>
  
  <pre><code>hello // Externally, doesn't.
  HI    // Internally, works as expected
  </code></pre>
  
  <p>What am I missing? It just seems like one of those things I should be able to accomplish easily. </p>
  
  <p>Please don't tell me I have to do a blanket "fieldAccess.replace" on all classes? O.O</p>