File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -3526,11 +3526,12 @@ public Map create() {
35263526 /**
35273527 * Converts a String to an Enum value.
35283528 */
3529- private <E extends Enum < E > > E stringToEnum (Class <?> enumClass , String value ) throws JSONException {
3529+ private <E > E stringToEnum (Class <?> enumClass , String value ) throws JSONException {
35303530 try {
35313531 @ SuppressWarnings ("unchecked" )
35323532 Class <E > enumType = (Class <E >) enumClass ;
3533- return Enum .valueOf (enumType , value );
3533+ Method valueOfMethod = enumType .getMethod ("valueOf" , String .class );
3534+ return (E ) valueOfMethod .invoke (null , value );
35343535 } catch (Exception e ) {
35353536 throw new JSONException ("Failed to convert string to enum: " + value + " for " + enumClass .getName (), e );
35363537 }
You can’t perform that action at this time.
0 commit comments