boolean (boolean isMethod, String identifier) { assert identifier != null : "Null identifier passed to the isValidIdentifier() method."; assert !identifier.isEmpty() : "Empty identifier passed to the isValidIdentifier() method."; if (isMethod && (identifier.equals(CodeConstants.INIT_NAME) || identifier.equals(CodeConstants.CLINIT_NAME))) { return true; } if (!Character.isJavaIdentifierStart(identifier.charAt(0))) { return false; } char[] chars = identifier.toCharArray(); for(int i = 1; i < chars.length; i++) { char ch = chars[i]; if ((!Character.isJavaIdentifierPart(ch)) || Character.isIdentifierIgnorable(ch)) { return false; } } return true; }