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

IllegalAccessError writing package-private property of other-package map-based type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0.0-alpha-8, 4.0.21
    • 5.0.0-alpha-9, 4.0.22
    • None
    • None

    Description

      Consider the following:

      package p;
      public class C extends java.util.HashMap {
        public    void setFoo(Object x) {}
        protected void setBar(Object x) {}
                  void setBaz(Object x) {}
        private   void setBoo(Object x) {}
      }
      
      @groovy.transform.CompileStatic
      void test(p.C p_c) {
        p_c.foo = null // works
        p_c.bar = null // SC: Method setBar is protected in p.C
        p_c.baz = null // IllegalAccessError
        p_c.boo = null // SC: Cannot call private method p.C#setBoo of class ...
      }
      

      Prior to GROOVY-11319, each of the non-public references produced error "Cannot access method setBxx(java.lang.Object) from class: p.C" – error improved by GROOVY-11223.

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: