PsiElement () { final Object value = myElement.getValue(); if (value instanceof String name) { final String type = getMemberType(myElement); if (type != null) { final ReflectiveClass ownerClass = getOwnerClass(); if (ownerClass != null) { return switch (type) { case GET_FIELD -> ownerClass.getPsiClass().findFieldByName(name, true); case GET_DECLARED_FIELD -> { final PsiField field = ownerClass.getPsiClass().findFieldByName(name, false); yield isPotentiallyAccessible(field, ownerClass) ? field : null; } case GET_METHOD -> { PsiMethod[] methods = ownerClass.getPsiClass().findMethodsByName(name, true); if (methods.length > 1) { methods = ContainerUtil.filter(methods, method -> isRegularMethod(method) && isPublic(method)) .toArray(PsiMethod.EMPTY_ARRAY); if (methods.length > 1) { yield findOverloadedMethod(methods); } } yield methods.length != 0 ? methods[0] : null; } case GET_DECLARED_METHOD -> { PsiMethod[] methods = ownerClass.getPsiClass().findMethodsByName(name, false); if (methods.length > 1) { methods = ContainerUtil.filter(methods, method -> isRegularMethod(method) && isPotentiallyAccessible(method, ownerClass)) .toArray(PsiMethod.EMPTY_ARRAY); if (methods.length > 1) { yield findOverloadedMethod(methods); } } yield methods.length != 0 ? methods[0] : null; } case NEW_UPDATER -> ownerClass.getPsiClass().findFieldByName(name, false); default -> null; }; } } } return null; }