PsiTypeElement () { PsiTypeElement typeElement = PsiTreeUtil.getChildOfType(this, PsiTypeElement.class); if (typeElement != null) return typeElement; final PsiElement parent = getParent(); assert parent != null : "no parent; " + this + "; [" + getText() + "]"; final PsiLocalVariable localVariable = PsiTreeUtil.getChildOfType(parent, PsiLocalVariable.class); assert localVariable != null : "no local variable in " + Arrays.toString(parent.getChildren()); typeElement = PsiTreeUtil.getChildOfType(localVariable, PsiTypeElement.class); assert typeElement != null : "no type element in " + Arrays.toString(localVariable.getChildren()); return typeElement; }