提交 9f3d45ae authored 作者: noelgrandin's avatar noelgrandin

revert my previous change, the code relies on this method returning unique objects

上级 cc99a464
......@@ -32,7 +32,8 @@ public class ClassUtils {
@SuppressWarnings("unchecked")
public static <T> T newObject(Class<T> clazz) {
// must create new instances
// must create new instances, cannot use methods like Boolean.FALSE, since the caller relies
// on this creating unique objects
if (clazz == Integer.class) {
return (T) new Integer((int) COUNTER.getAndIncrement());
} else if (clazz == String.class) {
......@@ -48,7 +49,7 @@ public class ClassUtils {
} else if (clazz == Double.class) {
return (T) new Double(COUNTER.getAndIncrement());
} else if (clazz == Boolean.class) {
return (T) Boolean.FALSE;
return (T) new Boolean(false);
} else if (clazz == BigDecimal.class) {
return (T) new BigDecimal(COUNTER.getAndIncrement());
} else if (clazz == BigInteger.class) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论