langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
changeset 22163 3651128c74eb
parent 21041 99f5e5e97425
child 22702 1297fbaf34fa
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
   178             } else { // repeated
   178             } else { // repeated
   179                 // This will break when other subtypes of Attributs.Compound
   179                 // This will break when other subtypes of Attributs.Compound
   180                 // are introduced, because PlaceHolder is a subtype of TypeCompound.
   180                 // are introduced, because PlaceHolder is a subtype of TypeCompound.
   181                 T res;
   181                 T res;
   182                 @SuppressWarnings("unchecked")
   182                 @SuppressWarnings("unchecked")
   183                 T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym);
   183                 T ph = (T) new Placeholder<>(ctx, lb.toList(), sym);
   184                 res = ph;
   184                 res = ph;
   185                 buf = buf.prepend(res);
   185                 buf = buf.prepend(res);
   186                 atLeastOneRepeated = true;
   186                 atLeastOneRepeated = true;
   187             }
   187             }
   188         }
   188         }
   242 
   242 
   243     public SymbolMetadata append(List<Attribute.Compound> l) {
   243     public SymbolMetadata append(List<Attribute.Compound> l) {
   244         attributes = filterDeclSentinels(attributes);
   244         attributes = filterDeclSentinels(attributes);
   245 
   245 
   246         if (l.isEmpty()) {
   246         if (l.isEmpty()) {
   247             ; // no-op
   247             // no-op
   248         } else if (attributes.isEmpty()) {
   248         } else if (attributes.isEmpty()) {
   249             attributes = l;
   249             attributes = l;
   250         } else {
   250         } else {
   251             attributes = attributes.appendList(l);
   251             attributes = attributes.appendList(l);
   252         }
   252         }
   253         return this;
   253         return this;
   254     }
   254     }
   255 
   255 
   256     public SymbolMetadata appendUniqueTypes(List<Attribute.TypeCompound> l) {
   256     public SymbolMetadata appendUniqueTypes(List<Attribute.TypeCompound> l) {
   257         if (l.isEmpty()) {
   257         if (l.isEmpty()) {
   258             ; // no-op
   258             // no-op
   259         } else if (type_attributes.isEmpty()) {
   259         } else if (type_attributes.isEmpty()) {
   260             type_attributes = l;
   260             type_attributes = l;
   261         } else {
   261         } else {
   262             // TODO: in case we expect a large number of annotations, this
   262             // TODO: in case we expect a large number of annotations, this
   263             // might be inefficient.
   263             // might be inefficient.
   269         return this;
   269         return this;
   270     }
   270     }
   271 
   271 
   272     public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
   272     public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
   273         if (l.isEmpty()) {
   273         if (l.isEmpty()) {
   274             ; // no-op
   274             // no-op
   275         } else if (init_type_attributes.isEmpty()) {
   275         } else if (init_type_attributes.isEmpty()) {
   276             init_type_attributes = l;
   276             init_type_attributes = l;
   277         } else {
   277         } else {
   278             init_type_attributes = init_type_attributes.appendList(l);
   278             init_type_attributes = init_type_attributes.appendList(l);
   279         }
   279         }
   280         return this;
   280         return this;
   281     }
   281     }
   282 
   282 
   283     public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
   283     public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
   284         if (l.isEmpty()) {
   284         if (l.isEmpty()) {
   285             ; // no-op
   285             // no-op
   286         } else if (clinit_type_attributes.isEmpty()) {
   286         } else if (clinit_type_attributes.isEmpty()) {
   287             clinit_type_attributes = l;
   287             clinit_type_attributes = l;
   288         } else {
   288         } else {
   289             clinit_type_attributes = clinit_type_attributes.appendList(l);
   289             clinit_type_attributes = clinit_type_attributes.appendList(l);
   290         }
   290         }
   293 
   293 
   294     public SymbolMetadata prepend(List<Attribute.Compound> l) {
   294     public SymbolMetadata prepend(List<Attribute.Compound> l) {
   295         attributes = filterDeclSentinels(attributes);
   295         attributes = filterDeclSentinels(attributes);
   296 
   296 
   297         if (l.isEmpty()) {
   297         if (l.isEmpty()) {
   298             ; // no-op
   298             // no-op
   299         } else if (attributes.isEmpty()) {
   299         } else if (attributes.isEmpty()) {
   300             attributes = l;
   300             attributes = l;
   301         } else {
   301         } else {
   302             attributes = attributes.prependList(l);
   302             attributes = attributes.prependList(l);
   303         }
   303         }