mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
DfaPsiUtil#isEnumPredefinedMethod: use CallMatchers
GitOrigin-RevId: 2b28d1b229f2127a0f19901eb595423373ec0228
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6b3a483775
commit
251f34e91f
@@ -283,16 +283,7 @@ public class DfaPsiUtil {
|
||||
}
|
||||
|
||||
private static boolean isEnumPredefinedMethod(PsiMethod method) {
|
||||
String methodName = method.getName();
|
||||
if (("valueOf".equals(methodName) || "values".equals(methodName)) && method.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass != null && containingClass.isEnum()) {
|
||||
PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
if ("values".equals(methodName)) return parameters.length == 0;
|
||||
return parameters.length == 1 && parameters[0].getType().equalsToText(JAVA_LANG_STRING);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return CallMatcher.enumValueOf().methodMatches(method) || CallMatcher.enumValues().methodMatches(method);
|
||||
}
|
||||
|
||||
public static boolean isInitializedNotNull(PsiField field) {
|
||||
|
||||
Reference in New Issue
Block a user