use of com.intellij.psi.PsiArrayInitializerMemberValue in project kotlin by JetBrains.
the class LintDriver method isSuppressed.
/**
* Returns true if the annotation member value, assumed to be specified on a a SuppressWarnings
* or SuppressLint annotation, specifies the given id (or "all").
*
* @param issue the issue to be checked
* @param value the member value to check
* @return true if the issue or all issues should be suppressed for this modifier
*/
public static boolean isSuppressed(@NonNull Issue issue, @Nullable PsiAnnotationMemberValue value) {
if (value instanceof PsiLiteral) {
PsiLiteral literal = (PsiLiteral) value;
Object literalValue = literal.getValue();
if (literalValue instanceof String) {
if (isSuppressed(issue, (String) literalValue)) {
return true;
}
}
} else if (value instanceof PsiArrayInitializerMemberValue) {
PsiArrayInitializerMemberValue mv = (PsiArrayInitializerMemberValue) value;
for (PsiAnnotationMemberValue mmv : mv.getInitializers()) {
if (isSuppressed(issue, mmv)) {
return true;
}
}
} else if (value instanceof PsiArrayInitializerExpression) {
PsiArrayInitializerExpression expression = (PsiArrayInitializerExpression) value;
PsiExpression[] initializers = expression.getInitializers();
for (PsiExpression e : initializers) {
if (isSuppressed(issue, e)) {
return true;
}
}
}
return false;
}
Aggregations