This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/try_to_fix_failing_master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit b8ff133acc9f309942f7f9e996b7339ffb3fc6c0
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Jan 4 00:45:03 2025 +0900

    Revert "Trivial tweak: Cache `thisType`"
    
    This reverts commit ae3cca0f1e0bf1e53c433508274f90f444192798.
---
 src/main/java/groovy/lang/Closure.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/main/java/groovy/lang/Closure.java 
b/src/main/java/groovy/lang/Closure.java
index 4ba76aa440..8524901aff 100644
--- a/src/main/java/groovy/lang/Closure.java
+++ b/src/main/java/groovy/lang/Closure.java
@@ -290,15 +290,10 @@ public abstract class Closure<V> extends 
GroovyObjectSupport implements Cloneabl
         return thisObject;
     }
 
-    private Class<?> thisType;
-    private Class<?> getThisType() {
-        Class<?> thisType = this.thisType;
-        if (thisType == null) {
-            thisType = getClass();
-            while (GeneratedClosure.class.isAssignableFrom(thisType)) {
-                thisType = thisType.getEnclosingClass();
-            }
-            this.thisType = thisType;
+    private Class getThisType() {
+        Class thisType = getClass();
+        while (GeneratedClosure.class.isAssignableFrom(thisType)) {
+            thisType = thisType.getEnclosingClass();
         }
         return thisType;
     }

Reply via email to