Source:
<code>private static Object coerce(Class<?> type, String value) { if (type.isPrimitive() && value == null) { return null; } try { if (String.class == type) { return value; } if (Boolean.class == type || boolean.class == type) { if ("true".equalsIgnoreCase(value)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(value)) { return Boolean.FALSE; } <START> return null; <END> } if (Byte.class == type || byte.class == type) { return Byte.valueOf(value); } if (Short.class == type || short.class == type) { return Short.valueOf(value); } if (Integer.class == type || int.class == type) { return Integer.valueOf(value); } if (Long.class == type || long.class == type) { return Long.valueOf(value); } if (Float.class == type || float.class == type) { return Float.valueOf(value); } if (Double.class == type || double.class == type) { return Double.valueOf(value); } } catch (Exception ignored) { return null; } if (type.isEnum()) { try { return Enum.valueOf(type.asSubclass(Enum.class), value); } catch (IllegalArgumentException e) { } Object match = null; for (Enum<?> option : type.asSubclass(Enum.class).getEnumConstants()) { if (option.name().equalsIgnoreCase(value)) { if (match != null) { return null; } match = option; } } return match; } try { Method fromString = type.getMethod("fromString", String.class); if (fromString.getReturnType().isAssignableFrom(type)) { return fromString.invoke(null, value); } } catch (Throwable ignored) { } try { Method valueOf = type.getMethod("valueOf", String.class); if (valueOf.getReturnType().isAssignableFrom(type)) { return valueOf.invoke(null, value); } } catch (Throwable ignored) { } try { Constructor<?> constructor = type.getConstructor(String.class); return constructor.newInstance(value); } catch (Throwable ignored) { } return null; }</code><technical_language>want fail in this case</technical_language>

Target:
private static Object coerce(Class<?> type, String value) { if (type.isPrimitive() && value == null) { return null; } try { if (String.class == type) { return value; } if (Boolean.class == type || boolean.class == type) { if ("true".equalsIgnoreCase(value)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(value)) { return Boolean.FALSE; } return null; } if (Byte.class == type || byte.class == type) { return Byte.valueOf(value); } if (Short.class == type || short.class == type) { return Short.valueOf(value); } if (Integer.class == type || int.class == type) { return Integer.valueOf(value); } if (Long.class == type || long.class == type) { return Long.valueOf(value); } if (Float.class == type || float.class == type) { return Float.valueOf(value); } if (Double.class == type || double.class == type) { return Double.valueOf(value); } } catch (Exception ignored) { return null; } try { Method fromString = type.getMethod("fromString", String.class); if (fromString.getReturnType().isAssignableFrom(type)) { try { return fromString.invoke(null, value); } catch (ReflectiveOperationException e) { return null; } } } catch (NoSuchMethodException ignored) { } if (type.isEnum()) { try { return Enum.valueOf(type.asSubclass(Enum.class), value); } catch (IllegalArgumentException e) { } Object match = null; for (Enum<?> option : type.asSubclass(Enum.class).getEnumConstants()) { if (option.name().equalsIgnoreCase(value)) { if (match != null) { return null; } match = option; } } return match; } try { Method valueOf = type.getMethod("valueOf", String.class); if (valueOf.getReturnType().isAssignableFrom(type)) { try { return valueOf.invoke(null, value); } catch (ReflectiveOperationException e) { return null; } } } catch (NoSuchMethodException ignored) { } try { Constructor<?> constructor = type.getConstructor(String.class); try { return constructor.newInstance(value); } catch (ReflectiveOperationException e) { return null; } } catch (NoSuchMethodException ignored) { } return null; }