File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
main/java/com/fasterxml/jackson/dataformat/ion
test/java/com/fasterxml/jackson/dataformat/ion Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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" );
Original file line number Diff line number Diff 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
29302.17 .0 (12 - Mar - 2024 )
3031
You can’t perform that action at this time.
0 commit comments