src/share/classes/com/sun/tools/javac/code/Attribute.java

Print this page

        

*** 140,150 **** * reference to the accessing method in the attribute interface * and the value to be returned when that method is called to * access this attribute. */ public final List<Pair<MethodSymbol,Attribute>> values; ! public TypeAnnotationPosition position; private boolean synthesized = false; @Override public boolean isSynthesized() { --- 140,150 ---- * reference to the accessing method in the attribute interface * and the value to be returned when that method is called to * access this attribute. */ public final List<Pair<MethodSymbol,Attribute>> values; ! public final TypeAnnotationPosition position; private boolean synthesized = false; @Override public boolean isSynthesized() {
*** 168,224 **** this(type, values, null); } @Override public TypeAnnotationPosition getPosition() { - if (hasUnknownPosition()) { - if (values.size() != 0) { - Name valueName = values.head.fst.name.table.names.value; - Pair<MethodSymbol, Attribute> res = getElemPair(valueName); - position = res == null ? null : res.snd.getPosition(); - } - } return position; } - public boolean isContainerTypeCompound() { - if (isSynthesized() && values.size() == 1) - return getFirstEmbeddedTC() != null; - return false; - } - - private Compound getFirstEmbeddedTC() { - if (values.size() == 1) { - Pair<MethodSymbol, Attribute> val = values.get(0); - if (val.fst.getSimpleName().contentEquals("value") - && val.snd instanceof Array) { - Array arr = (Array) val.snd; - if (arr.values.length != 0 - && arr.values[0] instanceof Attribute.TypeCompound) - return (Attribute.TypeCompound) arr.values[0]; - } - } - return null; - } - - public boolean tryFixPosition() { - if (!isContainerTypeCompound()) - return false; - - Compound from = getFirstEmbeddedTC(); - if (from != null && from.position != null && - from.position.type != TargetType.UNKNOWN) { - position = from.position; - return true; - } - return false; - } - - public boolean hasUnknownPosition() { - return position.type == TargetType.UNKNOWN; - } - public void accept(Visitor v) { v.visitCompound(this); } /** * Returns a string representation of this annotation. * String is of one of the forms: --- 168,180 ----