You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2019/10/11 20:14:02 UTC
[groovy] branch master updated: fix for NPE
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 22a46a1 fix for NPE
22a46a1 is described below
commit 22a46a113e935745a699c7fac753c94e69ce053e
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Oct 11 15:11:46 2019 -0500
fix for NPE
closes #810
---
.../java/groovy/lang/MissingMethodException.java | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/main/java/groovy/lang/MissingMethodException.java b/src/main/java/groovy/lang/MissingMethodException.java
index 3dbaf86..6a9a857 100644
--- a/src/main/java/groovy/lang/MissingMethodException.java
+++ b/src/main/java/groovy/lang/MissingMethodException.java
@@ -29,41 +29,41 @@ import org.codehaus.groovy.runtime.MethodRankHelper;
*/
public class MissingMethodException extends GroovyRuntimeException {
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
private static final long serialVersionUID = -6676430495683939401L;
+
private final String method;
- private final Class type;
+ private final Class<?> type;
private final boolean isStatic;
+ private final Object[] arguments;
- public Object[] getArguments() {
- return arguments;
- }
-
- private final Object arguments[];
-
- public MissingMethodException(String method, Class type, Object[] arguments) {
+ public MissingMethodException(String method, Class<?> type, Object[] arguments) {
this(method, type, arguments, false);
}
- public MissingMethodException(String method, Class type, Object[] arguments, boolean isStatic) {
+ public MissingMethodException(String method, Class<?> type, Object[] arguments, boolean isStatic) {
super();
this.method = method;
this.type = type;
this.isStatic = isStatic;
- this.arguments = arguments == null ? EMPTY_OBJECT_ARRAY : arguments;
+ this.arguments = arguments != null ? arguments : new Object[0];
+ }
+
+ public Object[] getArguments() {
+ return arguments;
}
+ @Override
public String getMessage() {
return "No signature of method: "
+ (isStatic ? "static " : "")
- + type.getName()
+ + (type != null ? type.getName() : "<unknown>")
+ "."
+ method
+ "() is applicable for argument types: ("
+ InvokerHelper.toTypeString(arguments, 60)
+ ") values: "
+ InvokerHelper.toArrayString(arguments, 60, true)
- + MethodRankHelper.getMethodSuggestionString(method, type, arguments);
+ + (type != null ? MethodRankHelper.getMethodSuggestionString(method, type, arguments) : "");
}
/**
@@ -76,7 +76,7 @@ public class MissingMethodException extends GroovyRuntimeException {
/**
* @return The type on which the method was attempted to be called
*/
- public Class getType() {
+ public Class<?> getType() {
return type;
}