1 Reply Latest reply on May 18, 2006 8:23 AM by bblfish

    Can't use $0 in edit(ConstructorCall arg)

    bblfish

      The following code

       StringBuffer code = new StringBuffer();
       code.append("com.sun.labs.rdf.sommer.Mapping.active().test($0);");
       code.append("$proceed($$);");
       System.out.println("code="+code.toString());
       arg.replace(code.toString());
      


      Throws the following exception

       java.lang.VerifyError: (class: eg/test/atom/MetaData, method: <init> signature: (Leg/test/atom/AtomId;Ljava/util/Date;)V) Expecting to find object/array on stack
       at eg.test.MappedTest.testEntryConstruction(MappedTest.java:74)
       at eg.test.MappedTest.main(MappedTest.java:80)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at javassist.Loader.run(Loader.java:273)
       at javassist.Loader.run(Loader.java:260)
       at com.sun.labs.rdf.sommer.ClassRewriter.main(ClassRewriter.java:53)
      


      I can use $class, $sig and $args without any problems though. How is one meant to use it?

        • 1. Re: Can't use $0 in edit(ConstructorCall arg)
          bblfish

          Looks like it works if instead of using $0 I just use 'this'.

          StringBuffer code = new StringBuffer();
          code.append("$proceed($$);");
          code.append("com.sun.labs.rdf.sommer.Mapping.active().test(this);");
          


          Also I noticed that one can only use 'this' after '$proceed($$);' otherwise one gets the same exception.