JavaResolveResult (PsiCall oldCall, PsiCall newCall) { final JavaResolveResult newResult; if (newCall instanceof PsiEnumConstant) { // do this manually, because PsiEnumConstantImpl.resolveMethodGenerics() will assert (no containing class for the copy) final PsiEnumConstant enumConstant = (PsiEnumConstant)oldCall; PsiClass containingClass = enumConstant.getContainingClass(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(enumConstant.getProject()); final PsiClassType type = facade.getElementFactory().createType(Objects.requireNonNull(containingClass)); newResult = facade.getResolveHelper().resolveConstructor(type, Objects.requireNonNull(newCall.getArgumentList()), enumConstant); } else { newResult = newCall.resolveMethodGenerics(); } return newResult; }