groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Minor refactoring: remove duplicated code of `AsmClassGenerator`
Date Wed, 07 Feb 2018 14:53:52 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 03c69caaf -> 714abf2c9


Minor refactoring: remove duplicated code of `AsmClassGenerator`


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

Branch: refs/heads/master
Commit: 714abf2c96b70dd68c07baaf0aa4ca4899ff0dd6
Parents: 03c69ca
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:53:50 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/714abf2c/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