c.get().getElementValues().entrySet().stream() .filter(e -> e.getKey().getSimpleName().contentEquals("value")) .map(e -> e.getValue())
private static ClassType determineShadowedClassName(ClassSymbol owner, VisitorState state) { for (Compound compound : owner.getAnnotationMirrors()) { if (Implements.class.getName().equals(compound.getAnnotationType().toString())) { for (Entry<MethodSymbol, Attribute> entry : compound.getElementValues().entrySet()) { String key = entry.getKey().name.toString(); Attribute value = entry.getValue(); if (key.equals("value")) { TypeMirror typeMirror = valueVisitor.visit(value); if (!typeMirror.equals(state.getTypeFromString("void"))) { return (ClassType) typeMirror; } } if (key.equals("className")) { String name = classNameVisitor.visit(value); if (!name.isEmpty()) { return (ClassType) state.getTypeFromString(name); } } } } } throw new RuntimeException("couldn't determine shadowed class for " + owner); }
private static ImmutableList<String> containerOf(VisitorState state, Compound attr) { Attribute m = attr.member(state.getName("containerOf")); if (m == null) { return ImmutableList.of(); } ImmutableList.Builder<String> containerOf = ImmutableList.builder(); m.accept( new SimpleAnnotationValueVisitor8<Void, Void>() { @Override public Void visitString(String s, Void unused) { containerOf.add(s); return null; } @Override public Void visitArray(List<? extends AnnotationValue> list, Void unused) { for (AnnotationValue value : list) { value.accept(this, null); } return null; } }, null); return containerOf.build(); }
Names names = Names.instance(task.getContext()); Attribute.Compound proprietaryAnno = new Attribute.Compound(syms.proprietaryType, List.<Pair<Symbol.MethodSymbol,Attribute>>nil()); Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1]; Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym; for (int i = 1; i < profileAnnos.length; i++) { profileAnnos[i] = new Attribute.Compound(syms.profileType, List.<Pair<Symbol.MethodSymbol, Attribute>>of( new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
Symtab syms = Symtab.instance(task.getContext()); Attribute.Compound proprietary = new Attribute.Compound(syms.proprietaryType, List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
Names names = Names.instance(task.getContext()); Attribute.Compound proprietaryAnno = new Attribute.Compound(syms.proprietaryType, List.<Pair<Symbol.MethodSymbol,Attribute>>nil()); Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1]; Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym; for (int i = 1; i < profileAnnos.length; i++) { profileAnnos[i] = new Attribute.Compound(syms.profileType, List.<Pair<Symbol.MethodSymbol, Attribute>>of( new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
Symtab syms = Symtab.instance(task.getContext()); Attribute.Compound proprietary = new Attribute.Compound(syms.proprietaryType, List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
return x; } else { Attribute.Compound c = new Attribute.Compound(targetContainerType, List.of(p)); JCAnnotation annoTree = m.Annotation(c); c.setSynthesized(true);
new TypeAnnotationPosition()); } else { return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null); } else { return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); Attribute.Compound ac = new Attribute.Compound(a.type, buf.toList()); a.attribute = ac; return ac;
return inferTargetMetaInfo(a, s); Attribute atValue = atTarget.member(names.value); if (!(atValue instanceof Attribute.Array)) { Assert.error("annotationType(): bad @Target argument " + atValue +
return x; } else { Attribute.Compound c = new Attribute.Compound(targetContainerType, List.of(p)); JCAnnotation annoTree = m.Annotation(c); c.setSynthesized(true);
return inferTargetMetaInfo(a, s); Attribute atValue = atTarget.member(names.value); if (!(atValue instanceof Attribute.Array)) { Assert.error("annotationType(): bad @Target argument " + atValue +
new TypeAnnotationPosition()); } else { return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null); } else { return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); Attribute.Compound ac = new Attribute.Compound(a.type, buf.toList()); a.attribute = ac; return ac;
a.type = chk.checkType(a.annotationType.pos(), at, expected); if (a.type.isErroneous()) return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0) { log.error(a.annotationType.pos(), "not.annotation.type", a.type.toString()); return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); ((MethodSymbol)method, value)); return new Attribute.Compound(a.type, buf.toList());
a.type = chk.checkType(a.annotationType.pos(), at, expected); if (a.type.isErroneous()) return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0) { log.error(a.annotationType.pos(), "not.annotation.type", a.type.toString()); return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); ((MethodSymbol)method, value)); return new Attribute.Compound(a.type, buf.toList());
c.get().getElementValues().entrySet().stream() .filter(e -> e.getKey().getSimpleName().contentEquals("value")) .map(e -> e.getValue())
a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym); if (atTarget == null) return true; Attribute atValue = atTarget.member(names.value); if (!(atValue instanceof Attribute.Array)) return true; // error recovery Attribute.Array arr = (Attribute.Array) atValue;
a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym); if (atTarget == null) return true; Attribute atValue = atTarget.member(names.value); if (!(atValue instanceof Attribute.Array)) return true; // error recovery Attribute.Array arr = (Attribute.Array) atValue;
DeclaredType annotationType = compound.getAnnotationType(); if (annotationType != null) Class<? extends Annotation> annotationClass = classFor((TypeElement) compound.getAnnotationType().asElement(), processingEnv); if (ParameterGroup.class.isAssignableFrom(annotationClass))
private static ImmutableList<String> containerOf(VisitorState state, Compound attr) { Attribute m = attr.member(state.getName("containerOf")); if (m == null) { return ImmutableList.of(); } ImmutableList.Builder<String> containerOf = ImmutableList.builder(); m.accept( new SimpleAnnotationValueVisitor8<Void, Void>() { @Override public Void visitString(String s, Void unused) { containerOf.add(s); return null; } @Override public Void visitArray(List<? extends AnnotationValue> list, Void unused) { for (AnnotationValue value : list) { value.accept(this, null); } return null; } }, null); return containerOf.build(); }