groovy
  1. groovy
  2. GROOVY-4767

Compilation error for generic interface method

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.5, 1.8-beta-2
    • Fix Version/s: 1.8.1, 1.7.11
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Repro:

      Compile

      interface Foo {
          public <N extends Number> void foo()
      }
      

      Result:

      unexpected token: public @ line 2, column 5.
             public <N extends Number> void foo()
             ^
      

      Making Foo an abstract class avoids the problem:

      abstract class Foo {
          public abstract <N extends Number> void foo()
      }
      

        Issue Links

          Activity

          Hide
          Paul King added a comment -

          I have put in a fix and done some initial testing. Any further testing you can do would be great. Now that this is fixed, it reveals some additional checks we need to do in the compiler regarding generics that haven't been completed before now. I am expecting those checks to be done as part of fixing GROOVY-4908.

          Show
          Paul King added a comment - I have put in a fix and done some initial testing. Any further testing you can do would be great. Now that this is fixed, it reveals some additional checks we need to do in the compiler regarding generics that haven't been completed before now. I am expecting those checks to be done as part of fixing GROOVY-4908 .

            People

            • Assignee:
              Paul King
              Reporter:
              Suk-Hyun Cho
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: