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

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


The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
     new cd15db6bf5 Trivial tweak: avoid unnecessary checks
cd15db6bf5 is described below

commit cd15db6bf5001591d3ef67a9862073a622535a6f
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Jan 11 14:45:34 2025 +0900

    Trivial tweak: avoid unnecessary checks
---
 src/main/java/groovy/lang/MetaClassImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/groovy/lang/MetaClassImpl.java 
b/src/main/java/groovy/lang/MetaClassImpl.java
index 013d1451ec..7e5889ea67 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -2591,8 +2591,8 @@ public class MetaClassImpl implements MetaClass, 
MutableMetaClass {
                 boolean isBooleanGetter = methodName.startsWith("is");
                 if (methodNameLength < (isBooleanGetter ? 3 : 4)) continue;
 
-                boolean isGetter = methodName.startsWith("get") || 
isBooleanGetter;
-                boolean isSetter = methodName.startsWith("set");
+                boolean isGetter = isBooleanGetter || 
methodName.startsWith("get");
+                boolean isSetter = !isGetter       && 
methodName.startsWith("set");
                 if (!isGetter && !isSetter) continue;
 
                 Object propertyMethods = filterPropertyMethod(isThis ? 
e.methods : e.methodsForSuper, isGetter, isBooleanGetter);

Reply via email to