Java Code Examples for com.sun.tools.javac.comp.Annotate#AnnotateRepeatedContext
The following examples show how to use
com.sun.tools.javac.comp.Annotate#AnnotateRepeatedContext .
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: SymbolMetadata.java From hottub with GNU General Public License v2.0 | 6 votes |
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) { Log log = ctx.log; // Process repeated annotations T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym); if (validRepeated != null) { // Check that the container isn't manually // present along with repeated instances of // its contained annotation. ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym); if (manualContainer != null) { log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present", manualContainer.first().type.tsym); } } // A null return will delete the Placeholder return validRepeated; }
Example 2
Source File: SymbolMetadata.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) { Log log = ctx.log; // Process repeated annotations T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym); if (validRepeated != null) { // Check that the container isn't manually // present along with repeated instances of // its contained annotation. ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym); if (manualContainer != null) { log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present", manualContainer.first().type.tsym); } } // A null return will delete the Placeholder return validRepeated; }
Example 3
Source File: SymbolMetadata.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public Placeholder(Annotate.AnnotateRepeatedContext<T> ctx, List<T> placeholderFor, Symbol on) { super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(), ctx.isTypeCompound ? ((Attribute.TypeCompound)placeholderFor.head).position : new TypeAnnotationPosition()); this.ctx = ctx; this.placeholderFor = placeholderFor; this.on = on; }
Example 4
Source File: SymbolMetadata.java From hottub with GNU General Public License v2.0 | 5 votes |
public Placeholder(Annotate.AnnotateRepeatedContext<T> ctx, List<T> placeholderFor, Symbol on) { super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(), ctx.isTypeCompound ? ((Attribute.TypeCompound)placeholderFor.head).position : new TypeAnnotationPosition()); this.ctx = ctx; this.placeholderFor = placeholderFor; this.on = on; }
Example 5
Source File: SymbolMetadata.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) { Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK)); this.setDeclarationAttributes(getAttributesForCompletion(ctx)); }
Example 6
Source File: SymbolMetadata.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { this.appendUniqueTypes(getAttributesForCompletion(ctx)); }
Example 7
Source File: Symbol.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { initedMetadata().appendTypeAttributesWithCompletion(ctx); }
Example 8
Source File: Symbol.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) { initedMetadata().setDeclarationAttributesWithCompletion(ctx); }
Example 9
Source File: SymbolMetadata.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { this.appendUniqueTypes(getAttributesForCompletion(ctx)); }
Example 10
Source File: SymbolMetadata.java From hottub with GNU General Public License v2.0 | 4 votes |
public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) { Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK)); this.setDeclarationAttributes(getAttributesForCompletion(ctx)); }
Example 11
Source File: SymbolMetadata.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public Annotate.AnnotateRepeatedContext<T> getRepeatedContext() { return ctx; }
Example 12
Source File: SymbolMetadata.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private <T extends Attribute.Compound> List<T> getAttributesForCompletion( final Annotate.AnnotateRepeatedContext<T> ctx) { Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated; boolean atLeastOneRepeated = false; List<T> buf = List.<T>nil(); for (ListBuffer<T> lb : annotated.values()) { if (lb.size() == 1) { buf = buf.prepend(lb.first()); } else { // repeated // This will break when other subtypes of Attributs.Compound // are introduced, because PlaceHolder is a subtype of TypeCompound. T res; @SuppressWarnings("unchecked") T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym); res = ph; buf = buf.prepend(res); atLeastOneRepeated = true; } } if (atLeastOneRepeated) { // The Symbol s is now annotated with a combination of // finished non-repeating annotations and placeholders for // repeating annotations. // // We need to do this in two passes because when creating // a container for a repeating annotation we must // guarantee that the @Repeatable on the // contained annotation is fully annotated // // The way we force this order is to do all repeating // annotations in a pass after all non-repeating are // finished. This will work because @Repeatable // is non-repeating and therefore will be annotated in the // fist pass. // Queue a pass that will replace Attribute.Placeholders // with Attribute.Compound (made from synthesized containers). ctx.annotateRepeated(new Annotate.Worker() { @Override public String toString() { return "repeated annotation pass of: " + sym + " in: " + sym.owner; } @Override public void run() { complete(ctx); } }); } // Add non-repeating attributes return buf.reverse(); }
Example 13
Source File: SymbolMetadata.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private <T extends Attribute.Compound> List<T> getAttributesForCompletion( final Annotate.AnnotateRepeatedContext<T> ctx) { Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated; boolean atLeastOneRepeated = false; List<T> buf = List.<T>nil(); for (ListBuffer<T> lb : annotated.values()) { if (lb.size() == 1) { buf = buf.prepend(lb.first()); } else { // repeated // This will break when other subtypes of Attributs.Compound // are introduced, because PlaceHolder is a subtype of TypeCompound. T res; @SuppressWarnings("unchecked") T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym); res = ph; buf = buf.prepend(res); atLeastOneRepeated = true; } } if (atLeastOneRepeated) { // The Symbol s is now annotated with a combination of // finished non-repeating annotations and placeholders for // repeating annotations. // // We need to do this in two passes because when creating // a container for a repeating annotation we must // guarantee that the @Repeatable on the // contained annotation is fully annotated // // The way we force this order is to do all repeating // annotations in a pass after all non-repeating are // finished. This will work because @Repeatable // is non-repeating and therefore will be annotated in the // fist pass. // Queue a pass that will replace Attribute.Placeholders // with Attribute.Compound (made from synthesized containers). ctx.annotateRepeated(new Annotate.Worker() { @Override public String toString() { return "repeated annotation pass of: " + sym + " in: " + sym.owner; } @Override public void run() { complete(ctx); } }); } // Add non-repeating attributes return buf.reverse(); }
Example 14
Source File: SymbolMetadata.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private <T extends Attribute.Compound> List<T> getAttributesForCompletion( final Annotate.AnnotateRepeatedContext<T> ctx) { Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated; boolean atLeastOneRepeated = false; List<T> buf = List.<T>nil(); for (ListBuffer<T> lb : annotated.values()) { if (lb.size() == 1) { buf = buf.prepend(lb.first()); } else { // repeated // This will break when other subtypes of Attributs.Compound // are introduced, because PlaceHolder is a subtype of TypeCompound. T res; @SuppressWarnings("unchecked") T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym); res = ph; buf = buf.prepend(res); atLeastOneRepeated = true; } } if (atLeastOneRepeated) { // The Symbol s is now annotated with a combination of // finished non-repeating annotations and placeholders for // repeating annotations. // // We need to do this in two passes because when creating // a container for a repeating annotation we must // guarantee that the @Repeatable on the // contained annotation is fully annotated // // The way we force this order is to do all repeating // annotations in a pass after all non-repeating are // finished. This will work because @Repeatable // is non-repeating and therefore will be annotated in the // fist pass. // Queue a pass that will replace Attribute.Placeholders // with Attribute.Compound (made from synthesized containers). ctx.annotateRepeated(new Annotate.Worker() { @Override public String toString() { return "repeated annotation pass of: " + sym + " in: " + sym.owner; } @Override public void run() { complete(ctx); } }); } // Add non-repeating attributes return buf.reverse(); }
Example 15
Source File: SymbolMetadata.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { this.appendUniqueTypes(getAttributesForCompletion(ctx)); }
Example 16
Source File: SymbolMetadata.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { this.appendUniqueTypes(getAttributesForCompletion(ctx)); }
Example 17
Source File: SymbolMetadata.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public Annotate.AnnotateRepeatedContext<T> getRepeatedContext() { return ctx; }
Example 18
Source File: SymbolMetadata.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public Annotate.AnnotateRepeatedContext<T> getRepeatedContext() { return ctx; }
Example 19
Source File: SymbolMetadata.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public Annotate.AnnotateRepeatedContext<T> getRepeatedContext() { return ctx; }
Example 20
Source File: SymbolMetadata.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private <T extends Attribute.Compound> List<T> getAttributesForCompletion( final Annotate.AnnotateRepeatedContext<T> ctx) { Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated; boolean atLeastOneRepeated = false; List<T> buf = List.<T>nil(); for (ListBuffer<T> lb : annotated.values()) { if (lb.size() == 1) { buf = buf.prepend(lb.first()); } else { // repeated // This will break when other subtypes of Attributs.Compound // are introduced, because PlaceHolder is a subtype of TypeCompound. T res; @SuppressWarnings("unchecked") T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym); res = ph; buf = buf.prepend(res); atLeastOneRepeated = true; } } if (atLeastOneRepeated) { // The Symbol s is now annotated with a combination of // finished non-repeating annotations and placeholders for // repeating annotations. // // We need to do this in two passes because when creating // a container for a repeating annotation we must // guarantee that the @Repeatable on the // contained annotation is fully annotated // // The way we force this order is to do all repeating // annotations in a pass after all non-repeating are // finished. This will work because @Repeatable // is non-repeating and therefore will be annotated in the // fist pass. // Queue a pass that will replace Attribute.Placeholders // with Attribute.Compound (made from synthesized containers). ctx.annotateRepeated(new Annotate.Worker() { @Override public String toString() { return "repeated annotation pass of: " + sym + " in: " + sym.owner; } @Override public void run() { complete(ctx); } }); } // Add non-repeating attributes return buf.reverse(); }