@@ -40,10 +40,10 @@ class LibGraalSubstitutions {
4040
4141 @ TargetClass (className = "jdk.vm.ci.services.Services" , onlyWith = LibGraalFeature .IsEnabled .class )
4242 static final class Target_jdk_vm_ci_services_Services {
43- /*
44- * Static final boolean field Services.IS_IN_NATIVE_IMAGE is used in many places in the
45- * JVMCI codebase to switch between the different implementations needed for regular use (a
46- * built-in module jdk.graal.compiler in the JVM) or as part of libgraal.
43+ /**
44+ * Static final boolean field {@code Services.IS_IN_NATIVE_IMAGE} is used in many places in
45+ * the JVMCI codebase to switch between the different implementations needed for regular use
46+ * (a built-in module {@code jdk.graal.compiler} in the JVM) or as part of libgraal.
4747 */
4848 // Checkstyle: stop
4949 @ Alias //
@@ -55,15 +55,15 @@ static final class Target_jdk_vm_ci_services_Services {
5555 @ TargetClass (className = "jdk.vm.ci.hotspot.Cleaner" , onlyWith = LibGraalFeature .IsEnabled .class )
5656 static final class Target_jdk_vm_ci_hotspot_Cleaner {
5757
58- /*
59- * Make package-private clean() accessible so that it can be called from
60- * LibGraalEntryPoints. doReferenceHandling().
58+ /**
59+ * Make package-private {@code clean()} accessible so that it can be called from
60+ * {@link LibGraalSupportImpl# doReferenceHandling()} .
6161 */
6262 @ Alias
6363 public static native void clean ();
6464 }
6565
66- /*
66+ /**
6767 * There are no String-based class-lookups happening at libgraal runtime. Thus, we can safely
6868 * prune all classloading-logic out of the image.
6969 */
@@ -87,14 +87,6 @@ public static Class<?> forName(Module module, String name) {
8787 }
8888 }
8989
90- @ TargetClass (value = java .lang .Module .class , onlyWith = LibGraalFeature .IsEnabled .class )
91- static final class Target_java_lang_Module {
92- @ Substitute
93- public Set <String > getPackages () {
94- return Collections .emptySet ();
95- }
96- }
97-
9890 @ TargetClass (value = java .lang .ClassLoader .class , onlyWith = LibGraalFeature .IsEnabled .class )
9991 static final class Target_java_lang_ClassLoader {
10092 @ Substitute
@@ -108,13 +100,43 @@ static Class<?> findBootstrapClassOrNull(String name) {
108100 }
109101 }
110102
103+ /**
104+ * Method {@link Module#getPackages()} is reachable via {@link java.util.Formatter}:
105+ *
106+ * <pre>
107+ * java.lang.Module.getPackages(Module.java:1166)
108+ * at java.lang.Module.getResourceAsStream(Module.java:1687)
109+ * at sun.util.resources.BreakIteratorResourceBundle.handleGetObject(BreakIteratorResourceBundle.java:72)
110+ * at java.util.ResourceBundle.getObject(ResourceBundle.java:549)
111+ * at java.util.ResourceBundle.getStringArray(ResourceBundle.java:532)
112+ * at sun.util.locale.provider.LocaleResources.getNumberStrings(LocaleResources.java:244)
113+ * at sun.util.locale.provider.LocaleResources.getNumberPatterns(LocaleResources.java:544)
114+ * at java.util.Formatter$FormatSpecifier.localizedMagnitude(Formatter.java:4719)
115+ * at java.util.Formatter$FormatSpecifier.print(Formatter.java:3511)
116+ * at java.util.Formatter$FormatSpecifier.print(Formatter.java:3496)
117+ * at java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:3194)
118+ * at java.util.Formatter$FormatSpecifier.print(Formatter.java:3155)
119+ * at java.util.Formatter.format(Formatter.java:2754)
120+ * </pre>
121+ *
122+ * It makes use of classloading-logic that we do not want to have in libgraal. Since this
123+ * code-path is not needed at runtime we can replace the implementation with a simple stub.
124+ */
125+ @ TargetClass (value = java .lang .Module .class , onlyWith = LibGraalFeature .IsEnabled .class )
126+ static final class Target_java_lang_Module {
127+ @ Substitute
128+ public Set <String > getPackages () {
129+ return Collections .emptySet ();
130+ }
131+ }
132+
111133 @ TargetClass (value = java .text .DateFormatSymbols .class , onlyWith = LibGraalFeature .IsEnabled .class )
112134 static final class Target_java_text_DateFormatSymbols {
113- /*
114- * DateFormatSymbols. getInstance(Locale) relies on String-based class-lookup (to find
115- * resource bundle sun.text.resources.cldr.FormatData) which we do not want to rely on at
116- * libgraal runtime because it increases image size too much. Instead, we return the
117- * DateFormatSymbols instance that we already have in the image heap.
135+ /**
136+ * {@link DateFormatSymbols# getInstance(Locale)} relies on String-based class-lookup (to
137+ * find resource bundle {@code sun.text.resources.cldr.FormatData} ) which we do not want to
138+ * rely on at libgraal runtime because it increases image size too much. Instead, we return
139+ * the DateFormatSymbols instance that we already have in the image heap.
118140 */
119141 @ Substitute
120142 public static DateFormatSymbols getInstance (Locale unused ) {
0 commit comments