com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry Java Examples
The following examples show how to use
com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeAnnotations.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #2
Source File: TypeAnnotations.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #3
Source File: TypeAnnotations.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #4
Source File: TypeAnnotations.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #5
Source File: IndexFileWriter.java From annotation-tools with MIT License | 6 votes |
private void printInnerTypes(String indentation, ATypeElement e) { for (Map. Entry<InnerTypeLocation, ATypeElement> ite : e.innerTypes.entrySet()) { InnerTypeLocation loc = ite.getKey(); AElement it = ite.getValue(); pw.print(indentation + "inner-type"); char sep = ' '; for (TypePathEntry l : loc.location) { pw.print(sep); pw.print(typePathEntryToString(l)); sep = ','; } pw.print(':'); printAnnotations(it); pw.println(); } }
Example #6
Source File: IndexFileWriter.java From annotation-tools with MIT License | 6 votes |
private void printInnerTypes(String indentation, ATypeElement e, ASTPath path) { for (Map. Entry<InnerTypeLocation, ATypeElement> ite : e.innerTypes.entrySet()) { InnerTypeLocation loc = ite.getKey(); AElement it = ite.getValue(); pw.print(indentation + "inner-type"); char sep = ' '; for (TypePathEntry l : loc.location) { pw.print(sep); pw.print(typePathEntryToString(l)); sep = ','; } pw.print(':'); printAnnotations(it); pw.println(); } }
Example #7
Source File: TypeAnnotations.java From hottub with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #8
Source File: TypeAnnotations.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #9
Source File: TypeAnnotations.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void locateNestedTypes(Type type, TypeAnnotationPosition p) { // The number of "steps" to get from the full type to the // left-most outer type. ListBuffer<TypePathEntry> depth = new ListBuffer<>(); Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.append(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } if (depth.nonEmpty()) { p.location = p.location.prependList(depth.toList()); } }
Example #10
Source File: SafeTypeAnnotationVisitor.java From annotation-tools with MIT License | 6 votes |
/** * Constructs a new <code> SafeTypeAnnotationVisitor </code> that * delegates all calls to the given visitor. * * @param xav the visitor to delegate all method calls to */ public SafeTypeAnnotationVisitor(TypeAnnotationVisitor xav) { this.xav = xav; // Start most of these with a capacity of one, since for legal annotations // they should not contain more than one element. xIndexArgs = new ArrayList<Integer>(1); xLengthArgs = new ArrayList<Integer>(1); xLocationArgs = new ArrayList<TypePathEntry>(); xLocationLengthArgs = new ArrayList<Integer>(1); xOffsetArgs = new ArrayList<Integer>(1); xStartPcArgs = new ArrayList<Integer>(1); xTargetTypeArgs = new ArrayList<Integer>(1); xParamIndexArgs = new ArrayList<Integer>(1); xBoundIndexArgs = new ArrayList<Integer>(1); xTypeIndexArgs = new ArrayList<Integer>(1); xNameAndArgsCount = 0; }
Example #11
Source File: TraceTypeAnnotationVisitor.java From annotation-tools with MIT License | 5 votes |
public void visitXLocation(TypePathEntry location) { this.xlocations[xlocations_index] = location; this.xlocations_index++; if(xav != null) { xav.visitXLocation(location); } }
Example #12
Source File: TraceTypeAnnotationVisitor.java From annotation-tools with MIT License | 5 votes |
public void visitXLocationLength(int location_length) { this.xlocation_length = location_length; this.xlocations = new TypePathEntry[this.xlocation_length]; this.xlocations_index = 0; if(xav != null) { xav.visitXLocationLength(location_length); } }
Example #13
Source File: ASMifierTypeAnnotationVisitor.java From annotation-tools with MIT License | 5 votes |
public void visitXLocation(TypePathEntry location) { buf.setLength(0); buf.append("xav").append(id).append(".visitXLocation("); buf.append(location.toString()); buf.append(");\n"); text.add(buf.toString()); }
Example #14
Source File: TypeASTMapper.java From annotation-tools with MIT License | 5 votes |
private static ATypeElement getInnerType(ATypeElement te, List<TypePathEntry> ls) { if (ls.isEmpty()) { return te; } else { return te.innerTypes.getVivify(new InnerTypeLocation(ls)); } }
Example #15
Source File: Insertions.java From annotation-tools with MIT License | 5 votes |
/** * Find an {@link ASTRecord} for the tree corresponding to a nested * type of the type (use) to which the given record corresponds. * * @param rec record of (outer) type AST to be annotated * @param loc inner type path * @return record that locates the (nested) type in the source */ private ASTRecord extendToInnerType(ASTRecord rec, List<TypePathEntry> loc) { ASTRecord r = rec; Iterator<TypePathEntry> iter = loc.iterator(); int depth = 0; while (iter.hasNext()) { TypePathEntry tpe = iter.next(); switch (tpe.tag) { case ARRAY: while (depth-- > 0) { r = r.extend(Tree.Kind.MEMBER_SELECT, ASTPath.EXPRESSION); } r = r.extend(Tree.Kind.ARRAY_TYPE, ASTPath.TYPE); break; case INNER_TYPE: ++depth; break; case TYPE_ARGUMENT: depth = 0; r = r.extend(Tree.Kind.PARAMETERIZED_TYPE, ASTPath.TYPE_ARGUMENT, tpe.arg); break; case WILDCARD: while (depth-- > 0) { r = r.extend(Tree.Kind.MEMBER_SELECT, ASTPath.EXPRESSION); } r = r.extend(Tree.Kind.UNBOUNDED_WILDCARD, ASTPath.BOUND); break; default: throw new RuntimeException(); } } while (depth-- > 0) { r = r.extend(Tree.Kind.MEMBER_SELECT, ASTPath.EXPRESSION); } return r; }
Example #16
Source File: IndexFileWriter.java From annotation-tools with MIT License | 5 votes |
private void printAmbElementAndInnerTypes(String indentation, String descriptor, AElement e) { printElement(indentation, descriptor, e); if (e.type.tlAnnotationsHere.isEmpty() && e.type.innerTypes.isEmpty()) { return; } printElement(indentation + INDENT, "type", e.type); for (Map. Entry<InnerTypeLocation, ATypeElement> ite : e.type.innerTypes.entrySet()) { InnerTypeLocation loc = ite.getKey(); AElement it = ite.getValue(); pw.print(indentation + INDENT + INDENT + "inner-type"); boolean first = true; for (TypePathEntry l : loc.location) { if (first) { pw.print(' '); } else { pw.print(','); } pw.print(typePathEntryToString(l)); first = false; } pw.print(':'); printAnnotations(it); pw.println(); } }
Example #17
Source File: GenericArrayLocationCriterion.java From annotation-tools with MIT License | 5 votes |
/** * Determines if the given list holds only {@link TypePathEntry}s with the tag * {@link TypePathEntryKind#ARRAY}. * * @param location the list to check * @return {@code true} if the list only contains * {@link TypePathEntryKind#ARRAY}, {@code false} otherwise. */ private boolean containsOnlyArray(List<TypePathEntry> location) { for (TypePathEntry tpe : location) { if (tpe.tag != TypePathEntryKind.ARRAY) { return false; } } return true; }
Example #18
Source File: ClassAnnotationSceneReader.java From annotation-tools with MIT License | 5 votes |
/** * Constructs a new AnnotationScene reader with the given description and * visibility. Calling visitEnd() will ensure that this writes out the * annotation it visits into aElement. * * @param descriptor JVML format for the field being read, or ClassAnnotationSceneReader.dummyDesc */ public AnnotationSceneReader(String descriptor, boolean visible, AElement aElement) { if (trace) { System.out.printf("AnnotationSceneReader(%s, %s, %s)%n", descriptor, visible, aElement); } this.visible = visible; this.aElement = aElement; if (descriptor != dummyDesc) { // interned AnnotationDef ad = getAnnotationDef(descriptor); AnnotationBuilder ab = AnnotationFactory.saf.beginAnnotation(ad, // This method is not in ASMX // "ClassReader " + cr.getClassName() "TODO: ClassAnnotationSceneReader" ); if (ab == null) { throw new IllegalArgumentException("bad description: " + descriptor); } else { this.annotationBuilder = ab; } } // For legal annotations, and except for xLocationsArgs, these should // contain at most one element. this.xTargetTypeArgs = new ArrayList<Integer>(1); this.xIndexArgs = new ArrayList<Integer>(1); this.xLengthArgs = new ArrayList<Integer>(1); this.xLocationLengthArgs = new ArrayList<Integer>(1); this.xOffsetArgs = new ArrayList<Integer>(1); this.xStartPcArgs = new ArrayList<Integer>(1); this.xLocationsArgs = new ArrayList<TypePathEntry>(); this.xParamIndexArgs = new ArrayList<Integer>(1); this.xBoundIndexArgs = new ArrayList<Integer>(1); this.xExceptionIndexArgs = new ArrayList<Integer>(1); this.xTypeIndexArgs = new ArrayList<Integer>(1); }
Example #19
Source File: TypeAnnotations.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private ListBuffer<TypePathEntry> locateNestedTypes(Type type, ListBuffer<TypePathEntry> depth) { Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.prepend(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } return depth; }
Example #20
Source File: ClassAnnotationSceneWriter.java From annotation-tools with MIT License | 5 votes |
/** * Have xav visit the location length and all locations in loc. */ private void visitLocations(TypeAnnotationVisitor xav, InnerTypeLocation loc) { List<TypePathEntry> location = loc.location; xav.visitXLocationLength(location.size()); for (TypePathEntry l : location) { xav.visitXLocation(l); } }
Example #21
Source File: AnnotationVerifier.java From annotation-tools with MIT License | 5 votes |
public AnnotationRecorder(String description) { this.description = description; fieldArgsName = new ArrayList<String>(); fieldArgsValue = new ArrayList<Object>(); enumArgsName = new ArrayList<String>(); enumArgsDesc = new ArrayList<String>(); enumArgsValue = new ArrayList<String>(); innerAnnotationArgsName = new ArrayList<String>(); innerAnnotationArgsDesc = new ArrayList<String>(); innerAnnotationMap = new HashMap<>(); arrayArgs = new ArrayList<String>(); arrayMap = new HashMap<>(); xIndexArgs = new ArrayList<Integer>(); xLengthArgs = new ArrayList<Integer>(); xLocationArgs = new ArrayList<TypePathEntry>(); xLocationLengthArgs = new ArrayList<Integer>(); xOffsetArgs = new ArrayList<Integer>(); xStartPcArgs = new ArrayList<Integer>(); xTargetTypeArgs = new ArrayList<Integer>(); xParamIndexArgs = new ArrayList<Integer>(); xBoundIndexArgs = new ArrayList<Integer>(); xExceptionIndexArgs = new ArrayList<Integer>(); xTypeIndexArgs = new ArrayList<Integer>(); }
Example #22
Source File: TypeAnnotations.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
private ListBuffer<TypePathEntry> locateNestedTypes(Type type, ListBuffer<TypePathEntry> depth) { Type encl = type.getEnclosingType(); while (encl != null && encl.getKind() != TypeKind.NONE && encl.getKind() != TypeKind.ERROR) { depth = depth.prepend(TypePathEntry.INNER_TYPE); encl = encl.getEnclosingType(); } return depth; }
Example #23
Source File: SafeTypeAnnotationVisitor.java From annotation-tools with MIT License | 4 votes |
@Override public void visitXLocation(TypePathEntry location) { xLocationArgs.add(location); xav.visitXLocation(location); }
Example #24
Source File: ClassAnnotationSceneReader.java From annotation-tools with MIT License | 4 votes |
@Override public void visitXLocation(TypePathEntry location) { xLocationsArgs.add(location); }
Example #25
Source File: TypeAnnotationConstantsCollector.java From annotation-tools with MIT License | 4 votes |
public void visitXLocation(TypePathEntry location) { xav.visitXLocation(location); }
Example #26
Source File: AnnotationVerifier.java From annotation-tools with MIT License | 4 votes |
public void visitXLocation(TypePathEntry location) { xLocationArgs.add(location); }
Example #27
Source File: EmptyVisitor.java From annotation-tools with MIT License | 4 votes |
public void visitXLocation(TypePathEntry location) { }
Example #28
Source File: TypeAnnotationWriter.java From annotation-tools with MIT License | 4 votes |
public void visitXLocation(TypePathEntry location) { this.xlocations[this.xlocations_index] = location; this.xlocations_index++; bv.putByte(location.tag.tag); bv.putByte(location.arg); }
Example #29
Source File: TypeAnnotationWriter.java From annotation-tools with MIT License | 4 votes |
public void visitXLocationLength(int location_length) { this.xlocations = new TypePathEntry[location_length]; this.xlocations_index = 0; bv.putByte(location_length); }
Example #30
Source File: GenericArrayLocationCriterion.java From annotation-tools with MIT License | 4 votes |
private GenericArrayLocationCriterion(List<TypePathEntry> location) { this.location = location; }