Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-319

IllegalAccessError when instrumenting anonymous inner class that accesses 'this'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • None
    • None
    • None
    • Hide

      The attached zip contains the reproducer.

      1) Build using "mvn clean install"
      2) Run using "mvn exec:exec" - this will run the app and byteman rules which attempts to print out the '$0' for the anonymous impl of the Subscriber interface.
      3) Either:
      a) Remove the +$0 from the 2nd and 3rd rules (scripts/rxjava.btm)
      b) or comment out the 'org.jboss.byteman.compileToBytecode' arg in the pom.,xml
      and re-run "mvn exec:exec" to see the app and rules working.

      Show
      The attached zip contains the reproducer. 1) Build using "mvn clean install" 2) Run using "mvn exec:exec" - this will run the app and byteman rules which attempts to print out the '$0' for the anonymous impl of the Subscriber interface. 3) Either: a) Remove the +$0 from the 2nd and 3rd rules (scripts/rxjava.btm) b) or comment out the 'org.jboss.byteman.compileToBytecode' arg in the pom.,xml and re-run "mvn exec:exec" to see the app and rules working.

    Description

      Not sure if this is related to BYTEMAN-318, but have a reproducer for an issue where an IllegalAccessError is thrown when an instrumented anonymous class attempts to access '$0'.

      However this only occurs when org.jboss.byteman.compileToBytecode is defined.

      The error:

      [INFO] --- exec-maven-plugin:1.4.0:exec (default-cli) @ byteman ---
      RxJava Subscribers create returning=rx.observers.Subscribers$3@4c75cab9
      rx.java(3) RxJava OnNext : java.lang.IllegalAccessError: tried to access class rx.observers.Subscribers$3 from class org.jboss.byteman.rule.helper.Helper_HelperAdapter_Compiled_2
      Exception in thread "main" org.jboss.byteman.rule.exception.ExecuteException: rx.java(3) RxJava OnNext  : caught java.lang.IllegalAccessError: tried to access class rx.observers.Subscribers$3 from class org.jboss.byteman.rule.helper.Helper_HelperAdapter_Compiled_2
      	at org.jboss.byteman.rule.Rule.execute(Rule.java:749)
      	at org.jboss.byteman.rule.Rule.execute(Rule.java:686)
      	at rx.observers.Subscribers$3.onNext(Subscribers.java)
      	at rxj.RxJavaMain.run(RxJavaMain.java:50)
      	at rxj.RxJavaMain.main(RxJavaMain.java:30)
      Caused by: java.lang.IllegalAccessError: tried to access class rx.observers.Subscribers$3 from class org.jboss.byteman.rule.helper.Helper_HelperAdapter_Compiled_2
      	at org.jboss.byteman.rule.helper.Helper_HelperAdapter_Compiled_2.execute0(rxjava.btm:25)
      	at org.jboss.byteman.rule.helper.Helper_HelperAdapter_Compiled_2.execute(rxjava.btm)
      	at org.jboss.byteman.rule.Rule.execute(Rule.java:717)
      	... 4 more
      

      Attachments

        Activity

          People

            rhn-engineering-adinn Andrew Dinn
            gary@brownuk.com Gary Brown
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: