GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1185

groovy class with an inner class does not compile

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1Release
    • Fix Version/s: 2.5.2.Release
    • Component/s: Compiler Integration
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I think I may have came across a bug. Below sample does not compile in eclipse 3.7 + groovy plugin 2.5.1 + groovy 1.7. However, it does compile outside eclipse.

      class WithInnerClass {
      		
      	interface InnerInterface {
      		void foo()
      	}
      
      	private final InnerInterface foo = new InnerInterface() {
      		void foo() {
      			
      		}
      	}
      }
      

      The problem has an easy workaround - make the inner class a top-level one. Hopefully, you'll find this report useful

      Thanks a bunch for the plugin!!!
      Cheers!

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Inside of Eclipse, I get a compile error when using the 1.7 compiler, but not when using the 1.8 compiler. I get the same behavior on the command line. Are you using groovy 1.8 on the command line, but 1.7 inside of Eclipse by any chance?

        Show
        Andrew Eisenberg added a comment - Inside of Eclipse, I get a compile error when using the 1.7 compiler, but not when using the 1.8 compiler. I get the same behavior on the command line. Are you using groovy 1.8 on the command line, but 1.7 inside of Eclipse by any chance?
        Hide
        Szczepan Faber added a comment -

        I'm pretty sure that we use 1.7.10. One thing I should mention earlier that it is a mixed java+groovy project.

        Show
        Szczepan Faber added a comment - I'm pretty sure that we use 1.7.10. One thing I should mention earlier that it is a mixed java+groovy project.
        Hide
        Andrew Eisenberg added a comment -

        OK. Interesting. Looking a bit more closely, it seems that I was using 1.7.2 on the command line, and when I upgraded to 1.7.10, I was able to successfully compile. But, I am still getting the compile error in Eclipse when using 1.7.10.

        I'll look into this since there should not be any differences in the syntax accepted inside of Eclipse and that accepted outside (we do patch the groovy compiler, but that should not have an effect on what can be compiled).

        Show
        Andrew Eisenberg added a comment - OK. Interesting. Looking a bit more closely, it seems that I was using 1.7.2 on the command line, and when I upgraded to 1.7.10, I was able to successfully compile. But, I am still getting the compile error in Eclipse when using 1.7.10. I'll look into this since there should not be any differences in the syntax accepted inside of Eclipse and that accepted outside (we do patch the groovy compiler, but that should not have an effect on what can be compiled).
        Hide
        Szczepan Faber added a comment -

        Ok. Thanks for info!

        Show
        Szczepan Faber added a comment - Ok. Thanks for info!
        Hide
        Andrew Eisenberg added a comment -

        I looked at the original code for 1.7.10 as well as the code for our patched 1.7.10. There is a discrepancy in AntlrParserPlugin. The unpatched version can handle inner-interfaces, but the patched version cannot. It looks like this was missed during the latest upgrade of the patch.

        Specifically, it looks like the innerInterfaceDef method exists in the unpatched version, but not the patched. Also, the objectBlock method has a case statement in its switch body for interfaces in the unpatched version, but not the patched.

        I'm assigning this bug to Andy since he is the one who created the groovy compiler patch. The build server is currently out of service, so we can't get a fix out to you today, but we will once the server is running again.

        Show
        Andrew Eisenberg added a comment - I looked at the original code for 1.7.10 as well as the code for our patched 1.7.10. There is a discrepancy in AntlrParserPlugin. The unpatched version can handle inner-interfaces, but the patched version cannot. It looks like this was missed during the latest upgrade of the patch. Specifically, it looks like the innerInterfaceDef method exists in the unpatched version, but not the patched. Also, the objectBlock method has a case statement in its switch body for interfaces in the unpatched version, but not the patched. I'm assigning this bug to Andy since he is the one who created the groovy compiler patch. The build server is currently out of service, so we can't get a fix out to you today, but we will once the server is running again.
        Hide
        Szczepan Faber added a comment -

        no worries, it's not critical. Thanks for info!

        Show
        Szczepan Faber added a comment - no worries, it's not critical. Thanks for info!
        Hide
        Andy Clement added a comment -

        dont think there is anything further I need to do, and the fix was in 2.5.2

        Show
        Andy Clement added a comment - dont think there is anything further I need to do, and the fix was in 2.5.2

          People

          • Assignee:
            Andy Clement
            Reporter:
            Szczepan Faber
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: