void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String methodName = methodExpression.getReferenceName(); if (!"isAnnotationPresent".equals(methodName) && !"getAnnotation".equals(methodName)) { return; } final PsiExpressionList argumentList = expression.getArgumentList(); final PsiExpression[] args = argumentList.getExpressions(); if (args.length != 1) { return; } final PsiExpression arg = args[0]; if (arg == null) { return; } if (!(arg instanceof PsiClassObjectAccessExpression classObjectAccessExpression)) { return; } final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (!TypeUtils.expressionHasTypeOrSubtype(qualifier, "java.lang.reflect.AnnotatedElement")) { return; } final PsiTypeElement operand = classObjectAccessExpression.getOperand(); final PsiClass annotationClass = PsiTypesUtil.getPsiClass(operand.getType()); if (annotationClass == null) { return; } final PsiModifierList modifierList = annotationClass.getModifierList(); if (modifierList == null) { return; } final PsiAnnotation retentionAnnotation = modifierList.findAnnotation(CommonClassNames.JAVA_LANG_ANNOTATION_RETENTION); if (retentionAnnotation == null) { if (annotationClass.isWritable()) { registerError(arg, annotationClass); } return; } final PsiAnnotationParameterList parameters = retentionAnnotation.getParameterList(); final PsiNameValuePair[] attributes = parameters.getAttributes(); for (PsiNameValuePair attribute : attributes) { @NonNls final String name = attribute.getName(); if (name != null && !PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(name)) { continue; } final PsiAnnotationMemberValue value = attribute.getValue(); if (value == null) { continue; } @NonNls final String text = value.getText(); if (!text.contains("RUNTIME")) { if (annotationClass.isWritable()) { registerError(arg, annotationClass, retentionAnnotation); } return; } } }