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

Groovy4 CTE: BUG! GStringImpl cannot be cast to class org.codehaus.groovy.ast.expr.Expression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-beta-1
    • None
    • Compiler
    • None
    • IntelliJ 2021.1.1 x64
      AdoptOpenJDK-11.0.11+9
      WIN 10

    Description

      • Just tried to rebuild our Groovy project with IntelliJ 2021.1 from scratch, and the handful of Java legacy classes that were never ported can all not find the imports of Groovy classes they depend on...
      • Java cross compilation errors IntelliJ shows are not the root cause
      • Managed to get the Groovyc build log output that IntelliJ always swallows immediately:
        Executing pre-compile tasks...
        Loading Ant configuration...
        Running Ant tasks...
        Running 'before' tasks
        Checking sources
        Groovyc: loading sources... [groovyutil]
        Groovyc: compiling... [groovyutil]
        Groovy stub generator: initialization [groovyutil]
        Groovy stub generator: parsing [groovyutil]
        Groovy compiler in operation... [groovyutil]
        Groovyc: While compiling [groovyutil]: Groovyc stub generation failed
        Groovyc: While compiling [groovyutil]: BUG! exception in phase 'conversion' in source unit '...groovyutil\groovy\GroovyFunctions.groovy' class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class org.codehaus.groovy.ast.expr.Expression (org.codehaus.groovy.runtime.GStringImpl and org.codehaus.groovy.ast.expr.Expression are in unnamed module of loader org.jetbrains.jps.incremental.groovy.JointCompilationClassLoader @500609dd)
        at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:888)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:654)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:631)
        at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:48)
        at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:118)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:81)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:167)
        at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:77)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
        Caused by: java.lang.ClassCastException: class org.codehaus.groovy.runtime.GStringImpl cannot be cast to class org.codehaus.groovy.ast.expr.Expression (org.codehaus.groovy.runtime.GStringImpl and org.codehaus.groovy.ast.expr.Expression are in unnamed module of loader org.jetbrains.jps.incremental.groovy.JointCompilationClassLoader @500609dd)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at org.codehaus.groovy.ast.GroovyCodeVisitor.visitListOfExpressions(GroovyCodeVisitor.java:209)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitListExpression(CodeVisitorSupport.java:254)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitListExpression(TransformingCodeVisitor.java:230)
        at org.codehaus.groovy.ast.expr.ListExpression.visit(ListExpression.java:63)
        at org.codehaus.groovy.ast.GroovyCodeVisitor.lambda$visitListOfExpressions$0(GroovyCodeVisitor.java:209)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at org.codehaus.groovy.ast.GroovyCodeVisitor.visitListOfExpressions(GroovyCodeVisitor.java:209)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:249)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitTupleExpression(TransformingCodeVisitor.java:224)
        at org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression.java:91)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:186)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:77)
        at org.codehaus.groovy.ast.GroovyCodeVisitor.lambda$visitListOfExpressions$0(GroovyCodeVisitor.java:209)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at org.codehaus.groovy.ast.GroovyCodeVisitor.visitListOfExpressions(GroovyCodeVisitor.java:209)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:249)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitTupleExpression(TransformingCodeVisitor.java:224)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:367)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitArgumentlistExpression(TransformingCodeVisitor.java:356)
        at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:75)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:186)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:77)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:117)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitExpressionStatement(TransformingCodeVisitor.java:110)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
        at org.codehaus.groovy.ast.TransformingCodeVisitor.visitBlockStatement(TransformingCodeVisitor.java:80)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:70)
        at org.codehaus.groovy.ast.MethodCallTransformation.visit(MethodCallTransformation.java:50)
        at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$addPhaseOperationsForGlobalTransforms$5(ASTTransformationVisitor.java:369)
        at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:884)
        ... 19 more
        Parsing java... [groovyutil]
        

      Attachments

        Activity

          People

            Unassigned Unassigned
            emge mgroovy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: