GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1435

GroovyEclipseBug: "Cannot find type variable on method" (private static method in Java class)

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.6.0.Release
    • Fix Version/s: 2.9.0.Release
    • Component/s: Compiler Integration
    • Labels:
      None
    • Environment:
      Mac OS X 10.6.8
      Eclipse Indigo Service Release 2.
    • Number of attachments :
      3

      Description

      I get the GroovyEclipseBug shown below.

      The method:
      private static T getMandatoryVal(Map map, String key, Class clazz)
      is delcared in a Java class SshjTool. The method is only called from within this class.

      The comilation error is reported on a different groovy class: EffectorSayHiTest.groovy, at line 0.


      General error during class generation: Cannot find type variable on method declaring element private static T getMandatoryVal(Map, java.lang.String, Class)

      org.codehaus.jdt.groovy.internal.compiler.ast.GroovyEclipseBug: Cannot find type variable on method declaring element private static T getMandatoryVal(Map, java.lang.String, Class)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.createClassNode(JDTResolver.java:531)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.createJDTClassNode(JDTResolver.java:448)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.convertToClassNode(JDTResolver.java:436)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.methodBindingToMethodNode(JDTClassNode.java:336)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeMembers(JDTClassNode.java:298)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize(JDTClassNode.java:231)
      at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit(JDTClassNode.java:155)
      at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:444)
      at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:1051)
      at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:1031)
      at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:1021)
      at org.codehaus.groovy.classgen.AsmClassGenerator.loadWrapper(AsmClassGenerator.java:1509)
      at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:303)
      at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:187)
      at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89)
      at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73)
      at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:292)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:657)
      at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75)
      at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:579)
      at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeReturn(OptimizingStatementWriter.java:316)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:499)
      at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:102)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:113)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:313)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:270)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:124)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:390)
      at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1170)
      at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:51)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:174)
      at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:829)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1122)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:594)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:572)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:549)
      at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:171)
      at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.generateCode(GroovyCompilationUnitDeclaration.java:1526)
      at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:831)
      at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
      at java.lang.Thread.run(Thread.java:680)


      This is with org.codehause.groovy.eclipse version 2.6.0, in Eclipse Indigo Service Release 2.


      See https://github.com/brooklyncentral/brooklyn/issues/50.

      You should be able to see the error by building the brooklyn repo with, for example, git commit b302e7.

      1. GRECLIPSE-1435-error-screenshot.png
        323 kB

        Activity

        Hide
        Andrew Eisenberg added a comment -

        The java.lang.NoSuchMethodError was a problem introduced in the last snapshot build only. Should be fixed in a few hours.

        Show
        Andrew Eisenberg added a comment - The java.lang.NoSuchMethodError was a problem introduced in the last snapshot build only. Should be fixed in a few hours.
        Hide
        John Martin added a comment -

        FYI - I don't know if this is related but I am getting the same error stacktrace as reported above. Today I allowed STS 2.9.2 on my system to perform some regular updates and since then I have been getting the above error (org.codehaus.groovy.ast.ClassNode.addPropertyWithoutField) when opening any groovy or gsp files, which is making my IDE useless.

        java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ClassNode.addPropertyWithoutField(Lorg/codehaus/groovy/ast/PropertyNode;)V
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeProperties(JDTClassNode.java:543)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.ensurePropertiesInitialized(JDTClassNode.java:526)
        at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.getProperties(JDTClassNode.java:621)
        at org.codehaus.groovy.classgen.VariableScopeVisitor.findClassMember(VariableScopeVisitor.java:184)
        at org.codehaus.groovy.classgen.VariableScopeVisitor.findClassMember(VariableScopeVisitor.java:188)
        at org.codehaus.groovy.classgen.VariableScopeVisitor.checkVariableNameForDeclaration(VariableScopeVisitor.java:249)
        at org.codehaus.groovy.classgen.VariableScopeVisitor.visitMethodCallExpression(VariableScopeVisitor.java:460)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitReturnStatement(CodeVisitorSupport.java:73)
        ...

        Show
        John Martin added a comment - FYI - I don't know if this is related but I am getting the same error stacktrace as reported above. Today I allowed STS 2.9.2 on my system to perform some regular updates and since then I have been getting the above error (org.codehaus.groovy.ast.ClassNode.addPropertyWithoutField) when opening any groovy or gsp files, which is making my IDE useless. java.lang.NoSuchMethodError: org.codehaus.groovy.ast.ClassNode.addPropertyWithoutField(Lorg/codehaus/groovy/ast/PropertyNode;)V at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeProperties(JDTClassNode.java:543) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.ensurePropertiesInitialized(JDTClassNode.java:526) at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.getProperties(JDTClassNode.java:621) at org.codehaus.groovy.classgen.VariableScopeVisitor.findClassMember(VariableScopeVisitor.java:184) at org.codehaus.groovy.classgen.VariableScopeVisitor.findClassMember(VariableScopeVisitor.java:188) at org.codehaus.groovy.classgen.VariableScopeVisitor.checkVariableNameForDeclaration(VariableScopeVisitor.java:249) at org.codehaus.groovy.classgen.VariableScopeVisitor.visitMethodCallExpression(VariableScopeVisitor.java:460) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75) at org.codehaus.groovy.ast.CodeVisitorSupport.visitReturnStatement(CodeVisitorSupport.java:73) ...
        Hide
        Andrew Eisenberg added a comment -

        Sorry...totally different problem. We put out a bad snapshot a little while ago. This problem is/should be fixed. Make sure you are installing from this update site:

        http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/
        or
        http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e4.2 (if using eclipse 4.2)

        Go to Help -> Install new software... In the work with box, add one of the urls above.

        Show
        Andrew Eisenberg added a comment - Sorry...totally different problem. We put out a bad snapshot a little while ago. This problem is/should be fixed. Make sure you are installing from this update site: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/ or http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e4.2 (if using eclipse 4.2) Go to Help -> Install new software... In the work with box, add one of the urls above.
        Hide
        John Martin added a comment -

        Thank you! Using the snapshot update site solved my problem. I had imported the bookmark.xml from http://dist.springsource.com/snapshot/TOOLS/composite/e3.7/bookmarks.xml as stated in the installation instructions for doing updates but that obviously didn't work.

        Show
        John Martin added a comment - Thank you! Using the snapshot update site solved my problem. I had imported the bookmark.xml from http://dist.springsource.com/snapshot/TOOLS/composite/e3.7/bookmarks.xml as stated in the installation instructions for doing updates but that obviously didn't work.
        Hide
        Andrew Eisenberg added a comment -

        Those bookmarks need to be updated. Thanks for pointing this out.

        Show
        Andrew Eisenberg added a comment - Those bookmarks need to be updated. Thanks for pointing this out.

          People

          • Assignee:
            Unassigned
            Reporter:
            Aled Sage
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: