You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/25 12:27:00 UTC
[jira] [Assigned] (GROOVY-11024) STC NPE when using Collectors.toMap() with a generic result
[ https://issues.apache.org/jira/browse/GROOVY-11024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-11024:
------------------------------------
Assignee: Eric Milles
> STC NPE when using Collectors.toMap() with a generic result
> -----------------------------------------------------------
>
> Key: GROOVY-11024
> URL: https://issues.apache.org/jira/browse/GROOVY-11024
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 4.0.11
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Major
>
> I'm not sure what the most specific culprit is, but this reproduces the problem reliably. (The original use case was using {{DynamoDbTable#index(String)}}, which also returns a generic result.)
> {code:groovy}
> import static java.util.function.Function.identity
> import static java.util.stream.Collectors.toMap
> import groovy.transform.CompileStatic
> @CompileStatic
> class Bug {
> Bug() {
> ['a'].stream().collect(toMap(identity(), List::of))
> }
> }
> {code}
> {code}
> [ERROR] Caused by: java.lang.NullPointerException: Cannot load from object array because the return value of "org.codehaus.groovy.ast.ClassNode.getGenericsTypes()" is null
> [ERROR] at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignableTo(StaticTypeCheckingSupport.java:496)
> [ERROR] at org.codehaus.groovy.ast.tools.ParameterUtils.parametersMatch(ParameterUtils.java:74)
> [ERROR] at org.codehaus.groovy.ast.tools.ParameterUtils.parametersCompatible(ParameterUtils.java:53)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticTypesMethodReferenceExpressionWriter.lambda$findMethodRefMethod$2(StaticTypesMethodReferenceExpressionWriter.java:334)
> [ERROR] at java.base/java.util.Collection.removeIf(Collection.java:576)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticTypesMethodReferenceExpressionWriter.findMethodRefMethod(StaticTypesMethodReferenceExpressionWriter.java:319)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticTypesMethodReferenceExpressionWriter.writeMethodReferenceExpression(StaticTypesMethodReferenceExpressionWriter.java:104)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodReferenceExpression(AsmClassGenerator.java:925)
> [ERROR] at org.codehaus.groovy.ast.expr.MethodReferenceExpression.visit(MethodReferenceExpression.java:34)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.visitArgument(StaticInvocationWriter.java:513)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.loadArguments(StaticInvocationWriter.java:460)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.writeDirectMethodCall(InvocationWriter.java:213)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.writeDirectMethodCall(StaticInvocationWriter.java:386)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeDirectCall(InvocationWriter.java:311)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:131)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:125)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.makeCall(StaticInvocationWriter.java:648)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:454)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.writeInvokeMethod(StaticInvocationWriter.java:136)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:988)
> [ERROR] at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:77)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.visitArgument(StaticInvocationWriter.java:513)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.loadArguments(StaticInvocationWriter.java:460)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.writeDirectMethodCall(InvocationWriter.java:213)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.writeDirectMethodCall(StaticInvocationWriter.java:386)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeDirectCall(InvocationWriter.java:311)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:131)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:125)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.makeCall(StaticInvocationWriter.java:648)
> [ERROR] at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:454)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter.writeInvokeMethod(StaticInvocationWriter.java:136)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:988)
> [ERROR] at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:77)
> [ERROR] at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:613)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:827)
> [ERROR] at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
> [ERROR] at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:95)
> [ERROR] at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:77)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:752)
> [ERROR] at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:72)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:611)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:546)
> [ERROR] at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:105)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructor(AsmClassGenerator.java:689)
> [ERROR] at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1121)
> [ERROR] at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
> [ERROR] at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:365)
> [ERROR] ... 41 more
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)