boolean (PsiAnnotation.TargetType[] types, PsiAnnotationMemberValue locations) { Set<String> locationNames = ContainerUtil.map2SetNotNull(AnnotationUtil.arrayAttributeValues(locations), l -> l instanceof PsiReferenceExpression ? ((PsiReferenceExpression)l) .getReferenceName() : null); if (locationNames.contains("ALL")) return true; for (PsiAnnotation.TargetType type : types) { if (type == PsiAnnotation.TargetType.FIELD) return locationNames.contains("FIELD"); if (type == PsiAnnotation.TargetType.METHOD) return locationNames.contains("RETURN"); if (type == PsiAnnotation.TargetType.PARAMETER) return locationNames.contains("PARAMETER"); if (type == PsiAnnotation.TargetType.LOCAL_VARIABLE) return locationNames.contains("LOCAL_VARIABLE"); } return false; }