PsiType (@NotNull PsiVariable variable) { PsiType type = null; if (variable instanceof GrVariable) { type = ((GrVariable)variable).getDeclaredType(); if (type == null) { type = ((GrVariable)variable).getTypeGroovy(); } } if (type == null) { type = variable.getType(); } return type; }