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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new fe06c00  Trivial refactoring: extract common variable
fe06c00 is described below

commit fe06c0039ff54347d2729d397dcde4b6661e42f9
Author: Daniel Sun <[email protected]>
AuthorDate: Fri Sep 18 08:24:04 2020 +0800

    Trivial refactoring: extract common variable
    
    (cherry picked from commit 5fdf048d8d099e58d87a7cb66e080217d48c1031)
---
 src/main/java/groovy/lang/MetaClassImpl.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/groovy/lang/MetaClassImpl.java 
b/src/main/java/groovy/lang/MetaClassImpl.java
index 59d45e6..019130b 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -2559,11 +2559,12 @@ public class MetaClassImpl implements MetaClass, 
MutableMetaClass {
             for (MetaMethodIndex.Entry e = header.head; e != null; e = 
e.nextClassEntry) {
                 String methodName = e.name;
                 // name too short?
-                if (methodName.length() < 3 ||
-                        (!methodName.startsWith("is") && methodName.length() < 
4)) continue;
+                final int methodNameLength = methodName.length();
+                if (methodNameLength < 3 ||
+                        (methodNameLength < 4 && 
!methodName.startsWith("is"))) continue;
                 // possible getter/setter?
-                boolean isGetter = methodName.startsWith("get") || 
methodName.startsWith("is");
                 boolean isBooleanGetter = methodName.startsWith("is");
+                boolean isGetter = methodName.startsWith("get") || 
isBooleanGetter;
                 boolean isSetter = methodName.startsWith("set");
                 if (!isGetter && !isSetter) continue;
 

Reply via email to