String (PsiLocalVariable variable) { // var x is not allowed as field if (variable.getTypeElement().isInferredType()) { PsiLocalVariable copy = (PsiLocalVariable)variable.copy(); PsiTypesUtil.replaceWithExplicitType(copy.getTypeElement()); return copy.getText(); } else { return variable.getText(); } }