String (PsiStatement statement, @NonNls String baseName) { final PsiElement ancestor = PsiTreeUtil.getParentOfType(statement, PsiMember.class); if (ancestor == null || !checkForLabel(baseName, ancestor)) { return baseName; } int val = 1; while (true) { final String name = baseName + val; if (!checkForLabel(name, ancestor)) { return name; } val++; } }