groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [4/4] groovy git commit: Minor refactoring: remove duplicated code of `AsmClassGenerator`
Date Wed, 07 Feb 2018 14:59:04 GMT
Minor refactoring: remove duplicated code of `AsmClassGenerator`

(cherry picked from commit 714abf2)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e89f8a01
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e89f8a01
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e89f8a01

Branch: refs/heads/GROOVY_2_6_X
Commit: e89f8a01db3d230fcfc04421d29cfc14e13c1140
Parents: 98adb35
Author: Daniel Sun <realbluesun@hotmail.com>
Authored: Wed Feb 7 22:53:50 2018 +0800
Committer: Daniel Sun <realbluesun@hotmail.com>
Committed: Wed Feb 7 22:58:52 2018 +0800

----------------------------------------------------------------------
 .../codehaus/groovy/classgen/AsmClassGenerator.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e89f8a01/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 099bc9c..4b7600f 100644
--- a/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -325,12 +325,18 @@ public class AsmClassGenerator extends ClassGenerator {
     private static int adjustedClassModifiersForInnerClassTable(ClassNode classNode) {
         int modifiers = classNode.getModifiers();
         modifiers = modifiers & ~ACC_SUPER;
+        modifiers = fixInterfaceModifiers(classNode, modifiers);
+
+        modifiers = fixInnerClassModifiers(classNode, modifiers);
+        return modifiers;
+    }
+
+    private static int fixInterfaceModifiers(ClassNode classNode, int modifiers) {
         // (JLS §9.1.1.1). Such a class file must not have its ACC_FINAL, ACC_SUPER or ACC_ENUM
flags set.
         if (classNode.isInterface()) {
             modifiers = modifiers & ~ACC_ENUM;
             modifiers = modifiers & ~ACC_FINAL;
         }
-        modifiers = fixInnerClassModifiers(classNode, modifiers);
         return modifiers;
     }
 
@@ -362,16 +368,10 @@ public class AsmClassGenerator extends ClassGenerator {
         // eliminate static
         modifiers = modifiers & ~ACC_STATIC;
         modifiers = fixInnerClassModifiers(classNode, modifiers);
-
-        // (JLS §9.1.1.1). Such a class file must not have its ACC_FINAL, ACC_SUPER or ACC_ENUM
flags set.
-        if (classNode.isInterface()) {
-            modifiers = modifiers & ~ACC_ENUM;
-            modifiers = modifiers & ~ACC_FINAL;
-        }
+        modifiers = fixInterfaceModifiers(classNode, modifiers);
         return modifiers;
     }
 
-
     public void visitGenericType(GenericsType genericsType) {
         ClassNode type = genericsType.getType();
         genericParameterNames.put(type.getName(), genericsType);


Mime
View raw message