jakartaee/jsonp-api

ClassCastException when including both the Javax and Jakarta implementation

Thihup opened this issue · 0 comments

Background: FasterXML/jackson-datatypes-misc#10

If a user includes both the old jar implementation and the new one, it will get a ClassCastException.
Looks like the released version (jakarta.json:2.0.0) don't have the service provider file in the META-INF/services. I can see it is in the source tree, but in the released version it doesn't have it.
So, trying to get the provider via ServiceLoader won't succeed, then it will fallback to load the default implementation. But if the user has both jars, it can try to load the org.glassfish.json.JsonProviderImpl from the old jar and cause a ClassCastException.