You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1259,8 +1258,8 @@ public void unexpectedDoubleToIntConversion() {
1259
1258
Stringkey30 = "key30";
1260
1259
Stringkey31 = "key31";
1261
1260
JSONObjectjsonObject = newJSONObject();
1262
-
jsonObject.put(key30, newDouble(3.0));
1263
-
jsonObject.put(key31, newDouble(3.1));
1261
+
jsonObject.put(key30, Double.valueOf(3.0));
1262
+
jsonObject.put(key31, Double.valueOf(3.1));
1264
1263
1265
1264
assertTrue("3.0 should remain a double",
1266
1265
jsonObject.getDouble(key30) == 3);
@@ -1713,19 +1712,19 @@ public void jsonObjectIncrement() {
1713
1712
*/
1714
1713
assertFalse("Document unexpected behaviour with explicit type-casting float as double!", (double)0.2f == 0.2d );
1715
1714
assertFalse("Document unexpected behaviour with implicit type-cast!", 0.2f == 0.2d );
1716
-
Doubled1 = newDouble( 1.1f );
1717
-
Doubled2 = newDouble( "1.1f" );
1715
+
Doubled1 = Double.valueOf( 1.1f );
1716
+
Doubled2 = Double.valueOf( "1.1f" );
1718
1717
assertFalse( "Document implicit type cast from float to double before calling Double(double d) constructor", d1.equals( d2 ) );
1719
1718
1720
-
assertTrue( "Correctly converting float to double via base10 (string) representation!", newDouble( 3.1d ).equals( newDouble( newFloat( 3.1f ).toString() ) ) );
1719
+
assertTrue( "Correctly converting float to double via base10 (string) representation!", Double.valueOf( 3.1d ).equals( Double.valueOf( Float.valueOf( 3.1f ).toString() ) ) );
1721
1720
1722
1721
// Pinpointing the not so obvious "buggy" conversion from float to double in JSONObject
1723
1722
JSONObjectjo = newJSONObject();
1724
1723
jo.put( "bug", 3.1f ); // will call put( String key, double value ) with implicit and "buggy" type-cast from float to double
1725
-
assertFalse( "The java-compiler did add some zero bits for you to the mantissa (unexpected, but well documented)", jo.get( "bug" ).equals( newDouble( 3.1d ) ) );
1724
+
assertFalse( "The java-compiler did add some zero bits for you to the mantissa (unexpected, but well documented)", jo.get( "bug" ).equals( Double.valueOf( 3.1d ) ) );
1726
1725
1727
1726
JSONObjectinc = newJSONObject();
1728
-
inc.put( "bug", newFloat( 3.1f ) ); // This will put in instance of Float into JSONObject, i.e. call put( String key, Object value )
1727
+
inc.put( "bug", Float.valueOf( 3.1f ) ); // This will put in instance of Float into JSONObject, i.e. call put( String key, Object value )
1729
1728
assertTrue( "Everything is ok here!", inc.get( "bug" ) instanceofFloat );
1730
1729
inc.increment( "bug" ); // after adding 1, increment will call put( String key, double value ) with implicit and "buggy" type-cast from float to double!
1731
1730
// this.put(key, (Float) value + 1);
@@ -2040,14 +2039,14 @@ public void valueToString() {
0 commit comments