PsiType () { GrTypeElement typeElement = getTypeElementGroovy(); PsiType declaredType = null; if (typeElement != null) { declaredType = typeElement.getType(); if (!(declaredType instanceof PsiClassType)) { return declaredType; } } PsiType initializerType = RecursionManager.doPreventingRecursion(this, true, this::getInitializerType); if (declaredType == null) { return initializerType; } if (initializerType instanceof PsiClassType && TypesUtil.isAssignableWithoutConversions(declaredType, initializerType)) { return initializerType; } return declaredType; }