提交 12ef3671 编写于 作者: J jfranck

8022260: Rename javac.code.Annotations to javac.code.SymbolMetadata

Reviewed-by: jfranck, jjg
Contributed-by: NAndreas Lundblad <andreas.lundblad@oracle.com>
上级 7d8778e2
......@@ -98,9 +98,9 @@ public abstract class Symbol implements Element {
// <editor-fold defaultstate="collapsed" desc="annotations">
/** The attributes of this symbol are contained in this
* Annotations. The Annotations instance is NOT immutable.
* SymbolMetadata. The SymbolMetadata instance is NOT immutable.
*/
protected Annotations annotations;
protected SymbolMetadata annotations;
/** An accessor method for the attributes of this symbol.
* Attributes of class symbols should be accessed through the accessor
......@@ -217,19 +217,19 @@ public abstract class Symbol implements Element {
public void setTypeAttributes(List<Attribute.TypeCompound> a) {
if (annotations != null || a.nonEmpty()) {
if (annotations == null)
annotations = new Annotations(this);
annotations = new SymbolMetadata(this);
annotations.setTypeAttributes(a);
}
}
private Annotations initedAnnos() {
private SymbolMetadata initedAnnos() {
if (annotations == null)
annotations = new Annotations(this);
annotations = new SymbolMetadata(this);
return annotations;
}
/** This method is intended for debugging only. */
public Annotations getAnnotations() {
public SymbolMetadata getAnnotations() {
return annotations;
}
......@@ -852,7 +852,7 @@ public abstract class Symbol implements Element {
private void mergeAttributes() {
if (annotations == null &&
package_info.annotations != null) {
annotations = new Annotations(this);
annotations = new SymbolMetadata(this);
annotations.setAttributes(package_info.annotations);
}
}
......
......@@ -57,7 +57,7 @@ import static com.sun.tools.javac.code.Kinds.PCK;
* later. You can reset to IN_PROGRESS. While IN_PROGRESS you can set the list
* of attributes (and this moves out of the IN_PROGRESS state).
*
* "unnamed" this Annotations contains some attributes, possibly the final set.
* "unnamed" this SymbolMetadata contains some attributes, possibly the final set.
* While in this state you can only prepend or append to the attributes not set
* it directly. You can also move back to the IN_PROGRESS state using reset().
*
......@@ -65,7 +65,7 @@ import static com.sun.tools.javac.code.Kinds.PCK;
* on this, you do so at your own risk. This code and its internal interfaces
* are subject to change or deletion without notice.</b>
*/
public class Annotations {
public class SymbolMetadata {
private static final List<Attribute.Compound> DECL_NOT_STARTED = List.of(null);
private static final List<Attribute.Compound> DECL_IN_PROGRESS = List.of(null);
......@@ -94,11 +94,11 @@ public class Annotations {
private List<Attribute.TypeCompound> clinit_type_attributes = List.<Attribute.TypeCompound>nil();
/*
* The Symbol this Annotations instance belongs to
* The Symbol this SymbolMetadata instance belongs to
*/
private final Symbol sym;
public Annotations(Symbol sym) {
public SymbolMetadata(Symbol sym) {
this.sym = sym;
}
......@@ -147,7 +147,7 @@ public class Annotations {
clinit_type_attributes = a;
}
public void setAttributes(Annotations other) {
public void setAttributes(SymbolMetadata other) {
if (other == null) {
throw new NullPointerException();
}
......@@ -221,7 +221,7 @@ public class Annotations {
return buf.reverse();
}
public Annotations reset() {
public SymbolMetadata reset() {
attributes = DECL_IN_PROGRESS;
return this;
}
......@@ -240,7 +240,7 @@ public class Annotations {
return attributes == DECL_IN_PROGRESS;
}
public Annotations append(List<Attribute.Compound> l) {
public SymbolMetadata append(List<Attribute.Compound> l) {
attributes = filterDeclSentinels(attributes);
if (l.isEmpty()) {
......@@ -253,7 +253,7 @@ public class Annotations {
return this;
}
public Annotations appendUniqueTypes(List<Attribute.TypeCompound> l) {
public SymbolMetadata appendUniqueTypes(List<Attribute.TypeCompound> l) {
if (l.isEmpty()) {
; // no-op
} else if (type_attributes.isEmpty()) {
......@@ -269,7 +269,7 @@ public class Annotations {
return this;
}
public Annotations appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.isEmpty()) {
; // no-op
} else if (init_type_attributes.isEmpty()) {
......@@ -280,7 +280,7 @@ public class Annotations {
return this;
}
public Annotations appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.isEmpty()) {
; // no-op
} else if (clinit_type_attributes.isEmpty()) {
......@@ -291,7 +291,7 @@ public class Annotations {
return this;
}
public Annotations prepend(List<Attribute.Compound> l) {
public SymbolMetadata prepend(List<Attribute.Compound> l) {
attributes = filterDeclSentinels(attributes);
if (l.isEmpty()) {
......@@ -367,7 +367,7 @@ public class Annotations {
type_attributes = result.reverse();
Assert.check(Annotations.this.getTypePlaceholders().isEmpty());
Assert.check(SymbolMetadata.this.getTypePlaceholders().isEmpty());
} else {
Assert.check(!pendingCompletion());
......@@ -391,7 +391,7 @@ public class Annotations {
attributes = result.reverse();
Assert.check(Annotations.this.getPlaceholders().isEmpty());
Assert.check(SymbolMetadata.this.getPlaceholders().isEmpty());
}
} finally {
log.useSource(oldSource);
......
......@@ -49,7 +49,7 @@ import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
import com.sun.source.util.Trees;
import com.sun.tools.javac.api.JavacTrees;
import com.sun.tools.javac.code.Annotations;
import com.sun.tools.javac.code.SymbolMetadata;
import com.sun.tools.javac.code.Attribute;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Kinds;
......@@ -186,21 +186,21 @@ public class DPrinter {
FULL
};
public void printAnnotations(String label, Annotations annotations) {
public void printAnnotations(String label, SymbolMetadata annotations) {
printAnnotations(label, annotations, Details.FULL);
}
protected void printAnnotations(String label, Annotations annotations, Details details) {
protected void printAnnotations(String label, SymbolMetadata annotations, Details details) {
if (annotations == null) {
printNull(label);
} else {
// no SUMMARY format currently available to use
// use reflection to get at private fields
Object DECL_NOT_STARTED = getField(null, Annotations.class, "DECL_NOT_STARTED");
Object DECL_IN_PROGRESS = getField(null, Annotations.class, "DECL_IN_PROGRESS");
Object attributes = getField(annotations, Annotations.class, "attributes");
Object type_attributes = getField(annotations, Annotations.class, "type_attributes");
Object DECL_NOT_STARTED = getField(null, SymbolMetadata.class, "DECL_NOT_STARTED");
Object DECL_IN_PROGRESS = getField(null, SymbolMetadata.class, "DECL_IN_PROGRESS");
Object attributes = getField(annotations, SymbolMetadata.class, "attributes");
Object type_attributes = getField(annotations, SymbolMetadata.class, "type_attributes");
if (!showEmptyItems) {
if (attributes instanceof List && ((List) attributes).isEmpty()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册