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/10/23 16:50:00 UTC

[jira] [Created] (GROOVY-11203) IllegalArgumentException: null argument for primitive lacks context

Eric Milles created GROOVY-11203:
------------------------------------

             Summary: IllegalArgumentException: null argument for primitive lacks context
                 Key: GROOVY-11203
                 URL: https://issues.apache.org/jira/browse/GROOVY-11203
             Project: Groovy
          Issue Type: Improvement
          Components: groovy-runtime
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
void setX(int x) {
  print x
}
def map = [:]
x = map.x // ParameterTypes#coerceArgumentsToClasses does not deal with null and primitive
{code}

Call to {{setX(int)}} via property write throws {{IllegalArgumentException}} at runtime.  The exception message and stack-trace don't provide much context.

{code}
java.lang.IllegalArgumentException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Scratch.run(Scratch.groovy:5)
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)