-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable "jakarta.json.provider" system property to work in JPMS apps. Provide explicit API to create JsonProvider instance #129
Comments
An alternative to introducing the proposed module org.eclipse.parsson {
requires transitive jakarta.json;
exports org.eclipse.parsson;
exports org.eclipse.parsson.api;
provides jakarta.json.spi.JsonProvider with org.eclipse.parsson.JsonProviderImpl;
} This would restore the API surface that non JPMS enabled applications see, so would minimize compatibility issues for non JPMS enabled applications that are in the process of migrating to JPMS. This might be the most pragmatic solution. |
…ovide explicit API to create JsonProvider instance eclipse-ee4j#129 Signed-off-by: Jorge Bescos Gascon <[email protected]>
Using a system property to define the expected implementation could have concurrent issues. For example with 2 threads:
However, we should fix the module visibility issue. Thank you for reporting it. |
…ovide explicit API to create JsonProvider instance #129 Signed-off-by: Jorge Bescos Gascon <[email protected]>
fixed by #130 |
There are a number of cases where an application may need to explicitly instantiate the Parsson
jakarta.json.spi.JsonProvider
instance and where usingJsonProvider.provider()
ServiceLoader based approach is not sufficient:ServiceLoader
mechanism which powersJsonProvider.provider()
has known performance side-effects and may need to be avoided.the addition of the JSONP_PROVIDER_FACTORY system property in JEE10 somewhat addresses this need.
However, this system property based solution does not work in JPMS enabled applications at present. For example if I have code like the following:
It will fail when running in a JPMS enabled runtime:
This could be addressed if Parsson opened the
org.eclipse.parsson
package tojakarta.json
:I think it would also be beneficial if Parsson provided a proprietary API to instantiate a JsonProvider:
This would give clients full control over how and when to instantiate the provider, similar to the capability non JPMS enabled applications enjoy to do
new org.eclipse.parsson.JsonProviderImpl()
wherever/whenever they need.The text was updated successfully, but these errors were encountered: