Skip to content

Commit cb43e22

Browse files
committed
Merge branch '2.17' of github.com:FasterXML/jackson-dataformats-binary into 2.17
2 parents 2de31bf + 4d4d141 commit cb43e22

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/IonParser.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ private double _getDoubleValue() throws IOException {
369369
@Override
370370
public float getFloatValue() throws IOException {
371371
_verifyIsNumberToken();
372+
// 04-May-2024, tatu: May seem odd but Ion really does not
373+
// expose 32-bit floats even if it MAY use them internally
374+
// for encoding. So:
372375
return (float) _getDoubleValue();
373376
}
374377

@@ -472,6 +475,7 @@ public NumberType getNumberType() throws IOException
472475
return NumberType.BIG_INTEGER;
473476
}
474477
case FLOAT:
478+
// 04-May-2024, tatu: Ion really does not expose 32-bit floats, so:
475479
return NumberType.DOUBLE;
476480
default:
477481
}
@@ -489,7 +493,9 @@ public NumberTypeFP getNumberTypeFP() throws IOException
489493
// 06-Jan-2024, tatu: Existing code maps Ion `FLOAT` into Java
490494
// `float`. But code in `IonReader` suggests `Double` might
491495
// be more accurate mapping... odd.
492-
return NumberTypeFP.FLOAT32;
496+
// 04-May-2024, tatu: Ion really does not expose 32-bit floats;
497+
// must expose as 64-bit here too
498+
return NumberTypeFP.DOUBLE64;
493499
}
494500
if (type == IonType.DECIMAL) {
495501
// 06-Jan-2024, tatu: Seems like `DECIMAL` is expected to map

ion/src/test/java/com/fasterxml/jackson/dataformat/ion/IonParserTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public void testGetNumberTypeAndValue() throws Exception {
7575
IonParser floatParser = new IonFactory().createParser(ionFloat);
7676
Assert.assertEquals(JsonToken.VALUE_NUMBER_FLOAT, floatParser.nextToken());
7777
Assert.assertEquals(JsonParser.NumberType.DOUBLE, floatParser.getNumberType());
78-
Assert.assertEquals(JsonParser.NumberTypeFP.FLOAT32, floatParser.getNumberTypeFP());
78+
// [dataformats-binary#490]: float coerces to double
79+
Assert.assertEquals(JsonParser.NumberTypeFP.DOUBLE64, floatParser.getNumberTypeFP());
7980
Assert.assertEquals(floatValue, floatParser.getNumberValue());
8081

8182
BigDecimal bigDecimalValue = new BigDecimal(Double.MAX_VALUE + "1");

release-notes/VERSION-2.x

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Active maintainers:
2323
#487 (ion): Don't close IonParser on EOF to be compatible with `MappingIterator`
2424
when source is an empty `InputStream`
2525
(contributed by Yoann V)
26-
2726
#488 (ion): Upgrade `ion-java` to 1.11.7 (from 1.11.2)
27+
#490 (ion) ION deserialization type change from Double to Float in 2.17.0
28+
(reported by Florian H)
2829

2930
2.17.0 (12-Mar-2024)
3031

0 commit comments

Comments
 (0)