XChange icon indicating copy to clipboard operation
XChange copied to clipboard

Incompatibility with Jackson 2.15.x (as used by Spring Boot 3.1.x)

Open rvullriede opened this issue 1 year ago • 0 comments

When you use XChange in a Spring Boot 3.1.x project you'll encounter problem with the deserialisation if IOrderFlags. An easy way to reproduce it is to simply upgrade to <version.fasterxml>2.15.2</version.fasterxml> in XChange's parent pom and run the tests.

The first failing tests is: BinanceAdaptersTest.testFilledMarketOrder:21 » MismatchedInput Unexpected token (VALUE_STRING), expected START_OBJECT: need JSON Object to contain As.WRAPPER_OBJECT type information for class org.knowm.xchange.binance.dto.trade.TimeInForce at [Source: (InputStreamReader); line: 11, column: 20] (through reference chain: org.knowm.xchange.binance.dto.trade.BinanceOrder["timeInForce"]) [ERROR] TradeServiceResilienceTest.shouldSucceedIfFirstCallTimeoutedAndRetryIsEnabled:39 » HttpStatusIO Unexpected token (VALUE_STRING), expected START_OBJECT: need JSON Object to contain As.WRAPPER_OBJECT type information for class org.knowm.xchange.binance.dto.trade.TimeInForce at [Source: (String)"[ { "symbol": "LTCBTC", "orderId": 1, "orderListId": -1, "clientOrderId": "myOrder1", "price": "0.1", "origQty": "1.0", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1499827319559, "updateTime": 1499827319559, "isWorking": true, "origQuoteOrderQty": "0.000000" }]"; line: 1, column: 236] (through reference chain: java.util.ArrayList[0]->org.knowm.xchange.binance.dto.trade.BinanceOrder["timeInForce"])

I went through Jackson's changelog and found the following issue which might be related: https://github.com/FasterXML/jackson-databind/issues/2968

I couldn't (yet) follow how Jackson is supposed to work in XChange related to type inheritance and didn't find an easy fix for this. I hope somebody else with deeper knowledge on this might be able to :-)

rvullriede avatar Oct 03 '23 20:10 rvullriede