/** * Returns the simple name of the given annotation mirror with a leading at symbol. */ @Pure public static @Nonnull String getSimpleNameWithLeadingAt(@Nonnull AnnotationMirror annotationMirror) { return "@" + getSimpleName(annotationMirror); }
/** * Returns the value of the given annotation mirror as a suffix for the method name. */ @Pure protected static @Nonnull String getSuffix(@Nonnull AnnotationMirror annotationMirror) { // The following line is only necessary because the IncorrectUsage testing annotation passes its own annotation mirror. if (ProcessingUtility.getSimpleName(annotationMirror).equals("IncorrectUsage")) { return ""; } final @Nullable AnnotationValue annotationValue = ProcessingUtility.getAnnotationValue(annotationMirror); final @Nullable String string = ProcessingUtility.getString(annotationValue); return string == null ? "" : Strings.uppercaseFirstCharacter(string); }
@Pure private @Nonnull String getAssignmentPrefix(@Nonnull TypeMirror fieldType, @Nonnull FiniteIterable<@Nonnull AnnotationMirror> annotationMirrors) { if (CustomType.of(fieldType, annotationMirrors).isCompositeType() && ProcessingUtility.getQualifiedName(fieldType).startsWith("net.digitalid.utility.collections.")) { return ProcessingUtility.getSimpleName(fieldType) + ".withElementsOf("; } return ""; }
/** * Returns whether the {@link #getElement() element} is declared in the Digital ID library (DID SDK). */ @Pure public default boolean isDeclaredInDigitalIDLibrary() { final @Nonnull String containingTypeName = ProcessingUtility.getSimpleName(getContainingType()); return ProcessingUtility.isDeclaredInDigitalIDLibrary(getElement()) && !containingTypeName.endsWith("Assert") && !containingTypeName.endsWith("Assertions"); }
@Pure @Override public void checkUsage(@Nonnull Element element, @Nonnull AnnotationMirror annotationMirror, @NonCaptured @Modified @Nonnull ErrorLogger errorLogger) { final @Nonnull TypeMirror declaredType = ProcessingUtility.getType(element); final @Nullable Class<?> desiredType = ProcessingUtility.getClass(ProcessingUtility.getAnnotationValue(annotationMirror)); if (desiredType != null && ProcessingUtility.isRawSubtype(declaredType, desiredType)) { errorLogger.log("The type $ is a subtype of $:", SourcePosition.of(element), ProcessingUtility.getSimpleName(declaredType), desiredType.getSimpleName()); } }
@Pure @Override public void checkUsage(@Nonnull Element element, @Nonnull AnnotationMirror annotationMirror, @NonCaptured @Modified @Nonnull ErrorLogger errorLogger) { final @Nonnull TypeMirror declaredType = ProcessingUtility.getType(element); final @Nullable Class<?> desiredType = ProcessingUtility.getClass(ProcessingUtility.getAnnotationValue(annotationMirror)); if (desiredType != null && !ProcessingUtility.isRawlyAssignable(declaredType, desiredType)) { errorLogger.log("The value of type $ is not rawly assignable to $:", SourcePosition.of(element), ProcessingUtility.getSimpleName(declaredType), desiredType.getSimpleName()); } }
@Pure @Override public void checkUsage(@Nonnull Element element, @Nonnull AnnotationMirror annotationMirror, @NonCaptured @Modified @Nonnull ErrorLogger errorLogger) { final @Nonnull TypeMirror declaredType = ProcessingUtility.getType(element); final @Nullable Class<?> desiredType = ProcessingUtility.getClass(ProcessingUtility.getAnnotationValue(annotationMirror)); if (desiredType != null && !ProcessingUtility.isRawSubtype(declaredType, desiredType)) { errorLogger.log("The type $ is not a subtype of $:", SourcePosition.of(element), ProcessingUtility.getSimpleName(declaredType), desiredType.getSimpleName()); } }
@Pure @Override public void checkUsage(@Nonnull Element element, @Nonnull AnnotationMirror annotationMirror, @NonCaptured @Modified @Nonnull ErrorLogger errorLogger) { final @Nonnull TypeMirror declaredType = ProcessingUtility.getType(element); final @Nullable Class<?> desiredType = ProcessingUtility.getClass(ProcessingUtility.getAnnotationValue(annotationMirror)); if (desiredType != null && ProcessingUtility.isRawlyAssignable(declaredType, desiredType)) { errorLogger.log("The value of type $ is rawly assignable to $:", SourcePosition.of(element), ProcessingUtility.getSimpleName(declaredType), desiredType.getSimpleName()); } }
if (alreadyProcessedAnnotations.add(annotationClass)) { final @Nonnull String annotationName = ProcessingUtility.getSimpleName(annotation); final @Nonnull String qualifiedAnnotationName = ProcessingUtility.getQualifiedName(annotation.getAnnotationType()); final @Nonnull String annotationValuesMap = fieldName + Strings.capitalizeFirstLetters(annotationName);
final boolean nullable = !field.hasAnnotation(NonNullableElements.class); final @Nonnull String collector; final @Nonnull String typeName = ProcessingUtility.getSimpleName(type); if (type.getKind() == TypeKind.ARRAY) { collector = importIfPossible(ArrayCollector.class) + "::with"; } else if (ProcessingUtility.isRawSubtype(type, List.class)) {