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

Call to an interface method results in IllegalAccessError when not implemented as "public"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8-beta-1
    • 1.7.2, 1.8-beta-1
    • None
    • None

    Description

      class C implements I {
          protected foo() {}
      }
      
      interface I {
          def foo()
      }
      
      def c = new C()
      c.foo()
      

      The code above results in the error below

      Caught: java.lang.IllegalAccessError: C.foo()Ljava/lang/Object;
      	at Try.run(Try.groovy:10)
      

      If the interface methods are not implemented with public visibility, the compiler should crib.

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            roshandawrani Roshan Dawrani
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: