String (@NotNull String name) { StringBuilder result = new StringBuilder(name.length()); for (int i = 0; i < name.length(); i++) { char ch = name.charAt(i); if (Character.isJavaIdentifierPart(ch)) { if (result.length() == 0 && !Character.isJavaIdentifierStart(ch)) { result.append("_"); } result.append(ch); } } return result.toString(); }