VariableDescriptor (final PsiElement target) { SpecialField sf = SpecialField.findSpecialField(target); if (sf != null) { return sf; } if (target instanceof PsiVariable) { return new PlainDescriptor((PsiVariable)target); } if (target instanceof PsiMethod method) { // Assume that methods returning stream always return a new one if (InheritanceUtil.isInheritor(method.getReturnType(), JAVA_UTIL_STREAM_BASE_STREAM)) return null; if (method.getParameterList().isEmpty() && (PropertyUtilBase.isSimplePropertyGetter(method) || JavaMethodContractUtil.isPure(method) || isClassAnnotatedImmutable(method)) && isContractAllowedForGetter(method) && !UNSTABLE_METHODS.methodMatches(method)) { return new GetterDescriptor(method); } } return null; }