PsiSubstitutor (@Nullable PsiClass myBaseClass) { if (myBaseClass != null) { final PsiType[] typeArgs = getParameters(); final PsiTypeParameter[] typeParams = myBaseClass.getTypeParameters(); if (typeParams.length == typeArgs.length) { return PsiSubstitutor.EMPTY.putAll(myBaseClass, typeArgs); } else { return PsiSubstitutor.EMPTY.putAll(myBaseClass, createArray(typeParams.length)); } } else { return PsiSubstitutor.EMPTY; } }