private void checkMethodAnnotation( @NonNull JavaContext context, @NonNull ResolvedMethod method, @NonNull MethodInvocation node, @NonNull ResolvedAnnotation annotation) { String signature = annotation.getSignature(); if (CHECK_RESULT_ANNOTATION.equals(signature) || signature.endsWith(".CheckReturnValue")) { // support findbugs annotation too checkResult(context, node, annotation); } else if (signature.equals(PERMISSION_ANNOTATION)) { checkPermission(context, node, method, annotation); } else if (signature.endsWith(THREAD_SUFFIX) && signature.startsWith(SUPPORT_ANNOTATIONS_PREFIX)) { checkThreading(context, node, method, signature); } }
@NonNull Node argument, @NonNull ResolvedAnnotation annotation) { String signature = annotation.getSignature();
@Nullable static ResolvedAnnotation getRelevantAnnotation(@NonNull ResolvedAnnotation annotation) { String signature = annotation.getSignature(); if (signature.startsWith(SUPPORT_ANNOTATIONS_PREFIX)) {
if (resolved != null) { for (ResolvedAnnotation annotation : resolved.getAnnotations()) { String signature = annotation.getSignature(); if (signature.equals(COLOR_INT_ANNOTATION)) { return Collections.singletonList(COLOR_INT_MARKER_TYPE);
annotation = SupportAnnotationDetector.getRelevantAnnotation(annotation); if (annotation != null) { String signature = annotation.getSignature(); if (CALL_SUPER_ANNOTATION.equals(signature)) { return directSuper;
String name = annotation.getSignature(); if (name.startsWith(SUPPORT_ANNOTATIONS_PREFIX) && name.endsWith(THREAD_SUFFIX)) { String name = annotation.getSignature(); if (name.startsWith(SUPPORT_ANNOTATIONS_PREFIX) && name.endsWith(THREAD_SUFFIX)) {
@Nullable public ResolvedAnnotation getAnnotation(@NonNull ResolvedMethod method, int parameterIndex, @NonNull String type) { MethodInfo m = findMethod(method); if (m == null) { return null; } if (m.getParameterAnnotations() != null) { Collection<ResolvedAnnotation> annotations = m.getParameterAnnotations().get(parameterIndex); if (annotations != null) { for (ResolvedAnnotation annotation : annotations) { if (type.equals(annotation.getSignature())) { return annotation; } } } } return null; }
@Nullable public ResolvedAnnotation getAnnotation(@NonNull ResolvedMethod method, @NonNull String type) { MethodInfo m = findMethod(method); if (m == null) { return null; } List<ResolvedAnnotation> annotations = m.getAnnotations(); if (annotations != null) { for (ResolvedAnnotation annotation : annotations) { if (type.equals(annotation.getSignature())) { return annotation; } } } return null; }
@Nullable public ResolvedAnnotation getAnnotation(@NonNull ResolvedField field, @NonNull String type) { FieldInfo f = findField(field); if (f == null) { return null; } List<ResolvedAnnotation> annotations = f.getAnnotations(); if (annotations != null) { for (ResolvedAnnotation annotation : annotations) { if (type.equals(annotation.getSignature())) { return annotation; } } } return null; }
@Nullable public ResolvedAnnotation getAnnotation(@NonNull ResolvedPackage pkg, @NonNull String type) { ClassInfo c = findPackage(pkg); if (c == null) { return null; } List<ResolvedAnnotation> annotations = c.getAnnotations(); if (annotations != null) { for (ResolvedAnnotation annotation : annotations) { if (type.equals(annotation.getSignature())) { return annotation; } } } return null; }
@Nullable public ResolvedAnnotation getAnnotation(@NonNull ResolvedClass cls, @NonNull String type) { ClassInfo c = findClass(cls); if (c == null) { return null; } List<ResolvedAnnotation> annotations = c.getAnnotations(); if (annotations != null) { for (ResolvedAnnotation annotation : annotations) { if (type.equals(annotation.getSignature())) { return annotation; } } } return null; }