JSONUtil { static boolean isValidIdentifierStart( int codePoint, JSONConfig cfg ) { if ( cfg.isFullJSONIdentifierCodePoints() ){ return isValidIdentifierPart(codePoint, cfg); }else{ return codePoint == '_' || codePoint == '$' || (cfg.isUseECMA6() ? Character.isUnicodeIdentifierStart(codePoint) : Character.isLetter(codePoint)); } } private  JSONUtil(); static String toJSON( Object obj ); static String toJSON( Object obj, JSONConfig cfg ); static void toJSON( Object obj, Writer json ); static void toJSON( Object obj, JSONConfig cfg, Writer json ); static Set<String> getJavascriptReservedWords(); static boolean isReservedWord( String name ); static void checkValidJavascriptPropertyName( String propertyName, JSONConfig cfg ); static void checkValidJavascriptPropertyName( String propertyName ); static boolean isValidJavascriptPropertyName( String propertyName, JSONConfig cfg ); static boolean isValidJavascriptPropertyName( String propertyName );  }
@Test public void testBadStartPropertyNames() { JSONConfig cfg = new JSONConfig(); JsonObject jsonObj = new JsonObject(1, cfg); int[] codePoints = new int[1]; for ( int i = 0; i <= Character.MAX_CODE_POINT; i++ ){ if ( ! JSONUtil.isValidIdentifierStart(i, cfg) ){ codePoints[0] = i; testBadIdentifier(codePoints, 0, 1, jsonObj); } } }