String (@NotNull String expression) { PsiLocalVariable copy = (PsiLocalVariable)myVariable.copy(); PsiElementFactory factory = PsiElementFactory.getInstance(myVariable.getProject()); copy.setInitializer(factory.createExpressionFromText(expression, myVariable)); if (!needsAdditionalVariable()) { PsiModifierList modifierList = copy.getModifierList(); if (modifierList != null) modifierList.setModifierProperty(PsiModifier.FINAL, false); } return copy.getText(); }