1.1 --- a/src/share/classes/com/sun/tools/javac/code/Annotations.java Tue May 14 13:55:35 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Annotations.java Tue May 14 15:04:06 2013 -0700 1.3 @@ -76,11 +76,24 @@ 1.4 private List<Attribute.Compound> attributes = DECL_NOT_STARTED; 1.5 1.6 /* 1.7 - * This field should never be null 1.8 + * Type attributes for this symbol. 1.9 + * This field should never be null. 1.10 */ 1.11 private List<Attribute.TypeCompound> type_attributes = List.<Attribute.TypeCompound>nil(); 1.12 1.13 /* 1.14 + * Type attributes of initializers in this class. 1.15 + * Unused if the current symbol is not a ClassSymbol. 1.16 + */ 1.17 + private List<Attribute.TypeCompound> init_type_attributes = List.<Attribute.TypeCompound>nil(); 1.18 + 1.19 + /* 1.20 + * Type attributes of class initializers in this class. 1.21 + * Unused if the current symbol is not a ClassSymbol. 1.22 + */ 1.23 + private List<Attribute.TypeCompound> clinit_type_attributes = List.<Attribute.TypeCompound>nil(); 1.24 + 1.25 + /* 1.26 * The Symbol this Annotations instance belongs to 1.27 */ 1.28 private final Symbol sym; 1.29 @@ -97,6 +110,14 @@ 1.30 return type_attributes; 1.31 } 1.32 1.33 + public List<Attribute.TypeCompound> getInitTypeAttributes() { 1.34 + return init_type_attributes; 1.35 + } 1.36 + 1.37 + public List<Attribute.TypeCompound> getClassInitTypeAttributes() { 1.38 + return clinit_type_attributes; 1.39 + } 1.40 + 1.41 public void setDeclarationAttributes(List<Attribute.Compound> a) { 1.42 Assert.check(pendingCompletion() || !isStarted()); 1.43 if (a == null) { 1.44 @@ -112,12 +133,28 @@ 1.45 type_attributes = a; 1.46 } 1.47 1.48 + public void setInitTypeAttributes(List<Attribute.TypeCompound> a) { 1.49 + if (a == null) { 1.50 + throw new NullPointerException(); 1.51 + } 1.52 + init_type_attributes = a; 1.53 + } 1.54 + 1.55 + public void setClassInitTypeAttributes(List<Attribute.TypeCompound> a) { 1.56 + if (a == null) { 1.57 + throw new NullPointerException(); 1.58 + } 1.59 + clinit_type_attributes = a; 1.60 + } 1.61 + 1.62 public void setAttributes(Annotations other) { 1.63 if (other == null) { 1.64 throw new NullPointerException(); 1.65 } 1.66 setDeclarationAttributes(other.getDeclarationAttributes()); 1.67 setTypeAttributes(other.getTypeAttributes()); 1.68 + setInitTypeAttributes(other.getInitTypeAttributes()); 1.69 + setClassInitTypeAttributes(other.getClassInitTypeAttributes()); 1.70 } 1.71 1.72 public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) { 1.73 @@ -232,6 +269,28 @@ 1.74 return this; 1.75 } 1.76 1.77 + public Annotations appendInitTypeAttributes(List<Attribute.TypeCompound> l) { 1.78 + if (l.isEmpty()) { 1.79 + ; // no-op 1.80 + } else if (init_type_attributes.isEmpty()) { 1.81 + init_type_attributes = l; 1.82 + } else { 1.83 + init_type_attributes = init_type_attributes.appendList(l); 1.84 + } 1.85 + return this; 1.86 + } 1.87 + 1.88 + public Annotations appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) { 1.89 + if (l.isEmpty()) { 1.90 + ; // no-op 1.91 + } else if (clinit_type_attributes.isEmpty()) { 1.92 + clinit_type_attributes = l; 1.93 + } else { 1.94 + clinit_type_attributes = clinit_type_attributes.appendList(l); 1.95 + } 1.96 + return this; 1.97 + } 1.98 + 1.99 public Annotations prepend(List<Attribute.Compound> l) { 1.100 attributes = filterDeclSentinels(attributes); 1.101