groovy
  1. groovy
  2. GROOVY-4359

Generic types are incorrectly shared/resolved within the module

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-beta-1
    • Fix Version/s: 2.4.0-beta-4
    • Component/s: class generator
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The following code should not compile, as class A is defined as a generic class and not class B, but type variables' resolution is spilling over from A to other non-related classes in the same module.

      Test.groovy
      class A<T>{}
      
      class B {
          T f
      }
      

      However, the following should continue to work

      class A<T>{
          class B {
              T f
          }
      }
      

        Activity

        Hide
        Pascal Schumacher added a comment - - edited

        On current master this causes a compilation error:

        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
        test.groovy: 4: unable to resolve class T
        @ line 4, column 5.
        T f
        ^

        1 error

        so I'm resolving this.

        Show
        Pascal Schumacher added a comment - - edited On current master this causes a compilation error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 4: unable to resolve class T @ line 4, column 5. T f ^ 1 error so I'm resolving this.

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Roshan Dawrani
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: