@@ -40,10 +40,10 @@ class LibGraalSubstitutions {
40
40
41
41
@ TargetClass (className = "jdk.vm.ci.services.Services" , onlyWith = LibGraalFeature .IsEnabled .class )
42
42
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.
47
47
*/
48
48
// Checkstyle: stop
49
49
@ Alias //
@@ -55,15 +55,15 @@ static final class Target_jdk_vm_ci_services_Services {
55
55
@ TargetClass (className = "jdk.vm.ci.hotspot.Cleaner" , onlyWith = LibGraalFeature .IsEnabled .class )
56
56
static final class Target_jdk_vm_ci_hotspot_Cleaner {
57
57
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()} .
61
61
*/
62
62
@ Alias
63
63
public static native void clean ();
64
64
}
65
65
66
- /*
66
+ /**
67
67
* There are no String-based class-lookups happening at libgraal runtime. Thus, we can safely
68
68
* prune all classloading-logic out of the image.
69
69
*/
@@ -87,14 +87,6 @@ public static Class<?> forName(Module module, String name) {
87
87
}
88
88
}
89
89
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
-
98
90
@ TargetClass (value = java .lang .ClassLoader .class , onlyWith = LibGraalFeature .IsEnabled .class )
99
91
static final class Target_java_lang_ClassLoader {
100
92
@ Substitute
@@ -108,13 +100,43 @@ static Class<?> findBootstrapClassOrNull(String name) {
108
100
}
109
101
}
110
102
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
+
111
133
@ TargetClass (value = java .text .DateFormatSymbols .class , onlyWith = LibGraalFeature .IsEnabled .class )
112
134
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.
118
140
*/
119
141
@ Substitute
120
142
public static DateFormatSymbols getInstance (Locale unused ) {
0 commit comments