groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-9079) STC: NPE in StaticTypeCheckingVisitor.inferSAMTypeGenericsInAssignment
Date Sun, 14 Apr 2019 15:34:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-9079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Eric Milles updated GROOVY-9079:
--------------------------------
    Description: 
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
void meth() {
  java.util.concurrent.Callable<String> call = { -> '' }
}
{code}

This code produces:
{code}
BUG! exception in phase 'instruction selection' in source unit 'Blah.groovy' unexpected NullpointerException
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1148)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:654)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:632)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:609)
	...
Caused by: java.lang.NullPointerException
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferSAMTypeGenericsInAssignment(StaticTypeCheckingVisitor.java:4282)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.getResultType(StaticTypeCheckingVisitor.java:4133)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:831)
	...
{code}


The method in StaticTypeCheckingVisitor calls ClosureExpression.getParameters(), which returns
null for a closure expression like "{ -> '' }".

  was:
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
void meth() {
  java.util.concurrent.Callable<String> call = { -> }
}
{code}

This code produces:
{code}
BUG! exception in phase 'instruction selection' in source unit 'Blah.groovy' unexpected NullpointerException
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1148)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:654)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:632)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:609)
	...
Caused by: java.lang.NullPointerException
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferSAMTypeGenericsInAssignment(StaticTypeCheckingVisitor.java:4282)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.getResultType(StaticTypeCheckingVisitor.java:4133)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:831)
	...
{code}


The method in StaticTypeCheckingVisitor calls ClosureExpression.getParameters(), which returns
null for a closure expression like "{ -> }".


> STC: NPE in StaticTypeCheckingVisitor.inferSAMTypeGenericsInAssignment
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-9079
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9079
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> void meth() {
>   java.util.concurrent.Callable<String> call = { -> '' }
> }
> {code}
> This code produces:
> {code}
> BUG! exception in phase 'instruction selection' in source unit 'Blah.groovy' unexpected
NullpointerException
> 	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1148)
> 	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:654)
> 	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:632)
> 	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:609)
> 	...
> Caused by: java.lang.NullPointerException
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferSAMTypeGenericsInAssignment(StaticTypeCheckingVisitor.java:4282)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.getResultType(StaticTypeCheckingVisitor.java:4133)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:831)
> 	...
> {code}
> The method in StaticTypeCheckingVisitor calls ClosureExpression.getParameters(), which
returns null for a closure expression like "{ -> '' }".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message