groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7804) @CompileStatic/@TypeChecked unexpected NullpointerException compiler bug
Date Sat, 09 Apr 2016 17:22:25 GMT

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

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

Github user asfgit closed the pull request at:

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


> @CompileStatic/@TypeChecked unexpected NullpointerException compiler bug
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-7804
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7804
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.6
>         Environment: Windows, jdk1.8.0_60
>            Reporter: manuc66
>
> Those code produce compiler bug exception (see below) when @CompileStatic or  @TypeChecked
is used :
> @CompileStatic
> class KeywordApiMain {
>     static main(args) {
>         Optional.of("MH370").orElseThrow({ -> new RuntimeException() });
>     }
> }
> @CompileStatic
> class KeywordApiMain {
>     static main(args) {
>         Optional.of("MH370").orElseThrow { -> new RuntimeException() };
>     }
> }
> Those code just produce the expected behaviour when compiled and run without the annotation.
The workaround is simplifying the code to this :
> class KeywordApiMain {
>     static main(args) {
>         Optional.of("MH370").orElseThrow { new RuntimeException() };
>     }
> }
> The compiler output :
> Error:Groovyc: BUG! exception in phase 'instruction selection' in source unit '-------\XXXX.groovy'
unexpected NullpointerException
>                 at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1060)
>                 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 org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
>                 at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>                 at java.lang.reflect.Method.invoke(Method.java:497)
>                 at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>                 at java.lang.reflect.Method.invoke(Method.java:497)
>                 at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:156)
>                 at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.access$000(InProcessGroovyc.java:51)
>                 at org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:85)
>                 at org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:82)
>                 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>                 at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NullPointerException
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.extractTypesFromParameters(StaticTypeCheckingVisitor.java:4694)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.convertClosureTypeToSAMType(StaticTypeCheckingVisitor.java:4364)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferReturnTypeGenerics(StaticTypeCheckingVisitor.java:4259)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2938)
>                 at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:318)
>                 at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
>                 at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
>                 at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
>                 at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>                 at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>                 at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>                 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.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
>                 at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
>                 at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:165)
>                 at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
>                 at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
>                 at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
>                 at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:124)
>                 at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63)
>                 at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
>                 at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
>                 at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055)
>                 ... 22 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message