On 22/07/2021 23:30, Mandy Chung wrote:

I assume the class path is running on JDK <= 8, right? Otherwise

This is a reasonable approach for the resource bundles to load from both class path and module path when the resource bundles of a given name is packaged in multiple modules/JARs.

We considered extending the default ResourceBundle.Control implementation to search with a repackaged bundle name as AbstractResourceBundleProvider::toBundleName in addition to the current default Control::toBundleName.  This incurs higher lookup cost (e.g. when it fails with the search of p.foo.Resource_<lang>, it will search p.foo.<lang>.Resource.).  What you have is reasonable.

Mandy
I agree. Also just to point out that the ResourceBundle javadoc has a "Resource Bundles and Named Modules" section to outline the options for deployed resource bundles as modules. For the migration scenario where the resources are in .properties format then the simplest may be to just deploy the JAR files on the module path where they will be treated as automatic modules.  There are no split package issues unless the resources have been compiled as .class files.

-Alan

Reply via email to