Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6962

IllegalAccessError exception is raised when accessing inherited public method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.4
    • Fix Version/s: 2.3.5
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      Groovy Version: 2.3.4
      JVM: 1.7.0_51 Vendor: Oracle Corporation
      OS: Mac OS X

      Description

      Accessing a public final method declared in non public super class will raise IllegalAccessError exception. For example:

      Base.java
      package acme;
      class Base {  
        public final void foo()  { 
          System.out.println("Hello");
        } 
      }
      
      Test.java
      package acme;
      public class Test extends Base { }
      
      Main.groovy
      import groovy.transform.*
      import acme.*
      
      @CompileStatic
      class Main {
       
        public static void main(String[] args) {
          def x = new Test ();
          x.foo();
        }  
      }
      

      Result in the following exception

      Caught: java.lang.IllegalAccessError: tried to access class acme.Base from class Main
      java.lang.IllegalAccessError: tried to access class acme.Base from class Main
      	at Main.main(Main.groovy:9)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                melix C├ędric Champeau
                Reporter:
                pablo72 paolo di tommaso
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: