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

Inner interface of parent class unresolved in anon. inner class expression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.4
    • 4.0.0-alpha-1, 3.0.5, 2.5.13
    • None
    • None

    Description

      Consider the following:

      A.java

      package p;
      public class A {
        public interface I {
        }
      }
      

      B.groovy

      package q
      import p.A
      class B extends A {
        static I maker() {
          return new I() {} // error: unable to resolve class I
        }
      }
      

      The inner class "I" can be resolved for return type and class/variable expression (see GROOVY-8364). However the anonymous inner class usage is reporting an error. If "I" were a static inner class, it could be used in constructor call expression "new T()" but fails for "new T() {}".

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h