twilio / twilio-java

A Java library for communicating with the Twilio REST API and generating TwiML.
MIT License
482 stars 421 forks source link

remove dependency on javax jaxb-api #713

Closed codylerum closed 1 year ago

codylerum commented 1 year ago

Java Architecture for XML Binding (JAXB) is an unnecessary dependency and carries a lot of baggage by being included.

JAXB used to be included in Java SE but was removed in JDK 11 with JEP 320 https://openjdk.org/jeps/320. Due to this those wanting to support versions JDK11+ must include a dependency on jaxb-api

The situation gets more complicated going forward as with Jakarta EE9 (Was Java EE) the package has been renamed from javax to jakarta example: javax.xml.bind.DatatypeConverter to jakarta.xml.bind.DatatypeConverter. So those on EE9+ would end up having an overlapping packages javax.xml.bind and jakarta.xml.bind creating confusion on imports

Looking at the project there were only 3 uses of the jaxb project which were all using javax.xml.bind.DatatypeConverter to convert byte arrays to String representations.

Standard Java Base64 encoding can be used to replace DatatypeConverter#printBase64Binary DatatypeConverter.printBase64Binary(bytes) -> Base64.getEncoder().encodeToString(bytes)

The project already has a dependency on apache commons codec so DatatypeConverter#printHexBinary DatatypeConverter.printHexBinary(bytes) -> Hex.encodeHexString(bytes)

aldettinger commented 1 year ago

Hey, well done with this.

I guess it is still there in the 7.x branch. Would you know in which version it was removed ? version 8/9 ?

codylerum commented 1 year ago

@aldettinger https://github.com/twilio/twilio-java/releases/tag/9.1.0

aldettinger commented 1 year ago

@codylerum Many thanks for pointing out to the right release note :+1: We are upgrading Camel to Jakarta 10, so we would need to use twilio >= 9.1.