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

Compilation exception for a method with generics and default access modifier

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.0
    • None
    • Compiler
    • None

    Description

      The following code fails with a compilation exception due to "bad syntax"

      Foo.java
      public interface Foo {}
      
      Bar.groovy
      class Bar {
          <Foo> void foo() {}
      }
      
      groovyc Foo.java Bar.groovy 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Bar.groovy: 2: unexpected token: < @ line 2, column 5.
             <Foo> void foo() {}
             ^
      
      1 error
      

      However if the public modifier is added to the method declaration this will work. BUT it breaks when @Delegate is added into the mix (I know AST xforms have plenty of corner cases, I'm pretty confident that if the 1st error is solved then @Delegate should work as well).

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            aalmiray Andres Almiray
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment