On 1/28/19 1:26 AM, Severin Gehwolf wrote:
Hi Alan, Mandy,
On Sun, 2019-01-27 at 08:14 +0000, Alan Bateman wrote:
On 26/01/2019 00:06, Mandy Chung wrote:
Hi Severin,
Another alternative would be to support per-jlink-plugin resource
bundle to avoid merging .properties files at build time. The
plugin-specific messages should only be used by the plugin itself
and it would be cleaner for each plugin to manage its resource bundle.
That seems a cleaner idea than the suggestion we had on jigsaw-dev to
merge the properties. If Severin does this for this plugin then I assume
the resources for the other plugins could be moved to their own resource
files in their own time.
Alright. I'll try this then.
One simplest way is to have StripNativeDebugSymbolsPlugin loads its own
ResourceBundle.
I would add a new PluginsResourceBundle::getMessage method taking a
ResourceBundle object
that StripNativeDebugSymbolsPlugin can call.
This is a patch for PluginsResourceBundle that you can use.
diff --git
a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/PluginsResourceBundle.java
b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/PluginsResourceBundle.java
---
a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/PluginsResourceBundle.java
+++
b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/PluginsResourceBundle.java
@@ -62,7 +62,11 @@
}
public static String getMessage(String key, Object... args) throws
MissingResourceException {
- String val = pluginsBundle.getString(key);
+ return getMessage(pluginsBundle, key, args);
+ }
+
+ public static String getMessage(ResourceBundle rb, String key,
Object... args) throws MissingResourceException {
+ String val = rb.getString(key);
return MessageFormat.format(val, args);
}
}
Mandy