groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] branch master updated: Trivial refactoring: Simplify the code further
Date Fri, 10 May 2019 15:52:33 GMT
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 b78f595  Trivial refactoring: Simplify the code further
b78f595 is described below

commit b78f5950795a48b741369feb163f1753f9930a18
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Fri May 10 23:51:58 2019 +0800

    Trivial refactoring: Simplify the code further
---
 .../java/org/codehaus/groovy/vmplugin/v9/Java9.java    | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
index f6412f3..0fa4b42 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -252,32 +252,20 @@ public class Java9 extends Java8 {
         if (isClassPublic && declaringModule.isExported(pn, callerModule)) {
             // member is public
             if (Modifier.isPublic(modifiers)) {
-                if (toCheckIllegalAccess) {
-                    return !isExportedForIllegalAccess(declaringModule, pn);
-                }
-
-                return true;
+                return !(toCheckIllegalAccess && isExportedForIllegalAccess(declaringModule,
pn));
             }
 
             // member is protected-static
             if (Modifier.isProtected(modifiers)
                     && Modifier.isStatic(modifiers)
                     && isSubclassOf(callerClass, declaringClass)) {
-                if (toCheckIllegalAccess) {
-                    return !isExportedForIllegalAccess(declaringModule, pn);
-                }
-
-                return true;
+                return !(toCheckIllegalAccess && isExportedForIllegalAccess(declaringModule,
pn));
             }
         }
 
         // package is open to callerClass
         if (declaringModule.isOpen(pn, callerModule)) {
-            if (toCheckIllegalAccess) {
-                return !isOpenedForIllegalAccess(declaringModule, pn);
-            }
-
-            return true;
+            return !(toCheckIllegalAccess && isOpenedForIllegalAccess(declaringModule,
pn));
         }
 
         return false;


Mime
View raw message