This is an automated email from the ASF dual-hosted git repository.
sunlan 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 90e8be8295 Trivial refactoring: extract internal method names
90e8be8295 is described below
commit 90e8be829570b59b88f755d364813df185faa8a1
Author: Daniel Sun <[email protected]>
AuthorDate: Sun Jan 12 03:11:34 2025 +0900
Trivial refactoring: extract internal method names
---
.../groovy/runtime/metaclass/ClosureMetaClass.java | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git
a/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java
b/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java
index 95495bba55..2d7332d332 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java
@@ -47,9 +47,12 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* A metaclass for closures generated by the Groovy compiler. These classes
@@ -372,17 +375,9 @@ public final class ClosureMetaClass extends MetaClassImpl {
throw first;
}
+ private static final Set<String> INTERNAL_METHODS = new
HashSet<>(Arrays.asList("curry", "ncurry", "rcurry", "leftShift",
"rightShift"));
private static boolean isInternalMethod(final String methodName) {
- switch (methodName) {
- case "curry":
- case "ncurry":
- case "rcurry":
- case "leftShift":
- case "rightShift":
- return true;
- default:
- return false;
- }
+ return INTERNAL_METHODS.contains(methodName);
}
private synchronized void initAttributes() {