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

An unexpected error has occurred when using 'kkk = kkk + 12'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.5
    • 2.4.9
    • Compiler
    • None
    • java.version=1.8.0_45
      java.runtime.version=1.8.0_45-b15
      os.arch=x86
      os.name=Windows 7
      sun.jnu.encoding=GBK

    Description

      Test groovy code:
      ------------------------------------

      package com.test
      
      def kkk = 123
      kkk = "123"
      
      println kkk.toInteger()
      
      int a = 0;
      
      if (a > 0)
      {
        kkk = 789
        kkk = kkk + 12 // This code caused error occur
      }
      else
      {
        kkk = "456"
        kkk = kkk + "78"
      }
      
      //println kkk.toUpperCase()
      println kkk
      

      Error message:
      ------------------------------------

      Exception in thread "main" BUG! exception in phase 'class generation' in source unit 'SimpleDemo' At line 13 column 9
      On receiver: kkk with message: plus and arguments: 12
      This method should not have been called. Please try to create a simple example reproducing this error and filea bug report at https://issues.apache.org/jira/browse/GROOVY
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:634)
      	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:616)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:529)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:230)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:148)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:638)
      	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateEqual(BinaryExpressionHelper.java:316)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesBinaryExpressionMultiTypeDispatcher.evaluateEqual(StaticTypesBinaryExpressionMultiTypeDispatcher.java:151)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:84)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:638)
      	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:607)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:620)
      	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:84)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:566)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeIfElse(StatementWriter.java:288)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitIfElse(AsmClassGenerator.java:582)
      	at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:43)
      	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:84)
      	at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:566)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:430)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:387)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:507)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:233)
      	at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:813)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:694)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:706)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:742)
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              x_MM1229 XueJun
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: