int () { PsiJavaCodeReferenceElement reference = getReference(); if (reference.getTypeParameterCount() == 0 && reference.getParent() instanceof PsiTypeElement && reference.getParent().getParent() instanceof PsiDeconstructionPattern) { ClassResolveResult result = resolveGenerics(); PsiClass cls = result.getElement(); if (cls != null && result.getInferenceError() == null) { return cls.getTypeParameters().length; } } return reference.getTypeParameterCount(); }