PsiElement () { GrVariable[] variables = getVariables(); if (variables.length == 0) return null; GrVariable resolved = variables[0]; PsiType typeGroovy = resolved.getTypeGroovy(); if (typeGroovy instanceof PsiClassType) { return ((PsiClassType)typeGroovy).resolve(); } else { return resolved; } }