You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/02/03 10:19:51 UTC

[jira] [Commented] (GROOVY-8030) An unexpected error has occurred when using 'kkk = kkk + 12'

    [ https://issues.apache.org/jira/browse/GROOVY-8030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15851296#comment-15851296 ] 

ASF GitHub Bot commented on GROOVY-8030:
----------------------------------------

GitHub user paulk-asert opened a pull request:

    https://github.com/apache/groovy/pull/488

    GROOVY-8030: An unexpected error has occurred when using 'kkk = kkk +…

    … 12'

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/groovy groovy8030

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/488.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #488
    
----
commit 1338c7c7cacabf316db13a71c0c4bdfa54741ce1
Author: paulk <pa...@asert.com.au>
Date:   2017-02-03T09:59:47Z

    GROOVY-8030: An unexpected error has occurred when using 'kkk = kkk + 12'

----


> An unexpected error has occurred when using 'kkk = kkk + 12'
> ------------------------------------------------------------
>
>                 Key: GROOVY-8030
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8030
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.5
>         Environment: 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
>            Reporter: XueJun
>
> Test groovy code:
> ------------------------------------
> {code:Java}
> 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
> {code}
> Error message:
> ------------------------------------
> {noformat}
> 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)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)