< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/SymbolMetadata.java

Print this page

        

@@ -253,6 +253,38 @@
     }
 
     private boolean isStarted() {
         return attributes != DECL_NOT_STARTED;
     }
+
+    private List<Attribute.Compound> removeFromCompoundList(List<Attribute.Compound> l, Attribute.Compound compound) {
+        ListBuffer<Attribute.Compound> lb = new ListBuffer<>();
+        for (Attribute.Compound c : l) {
+            if (c != compound) {
+                lb.add(c);
+            }
+        }
+        return lb.toList();
+    }
+
+    private List<Attribute.TypeCompound> removeFromTypeCompoundList(List<Attribute.TypeCompound> l, Attribute.TypeCompound compound) {
+        ListBuffer<Attribute.TypeCompound> lb = new ListBuffer<>();
+        for (Attribute.TypeCompound c : l) {
+            if (c != compound) {
+                lb.add(c);
+            }
+        }
+        return lb.toList();
+    }
+
+    public void remove(Attribute.Compound compound) {
+        if (attributes.contains(compound)) {
+            attributes = removeFromCompoundList(attributes, compound);
+        } else if (type_attributes.contains(compound)) {
+            type_attributes = removeFromTypeCompoundList(type_attributes, (TypeCompound)compound);
+        } else if (init_type_attributes.contains(compound)) {
+            init_type_attributes = removeFromTypeCompoundList(init_type_attributes, (TypeCompound)compound);
+        } else if (clinit_type_attributes.contains(compound)) {
+            clinit_type_attributes = removeFromTypeCompoundList(clinit_type_attributes, (TypeCompound)compound);
+        }
+    }
 }
< prev index next >