Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,20 @@ private static ResourceBundle getBundleFromModule(Class<?> caller,
private static native ClassLoader getLoader(Module module);

@Alias
private static native ResourceBundle getBundleImpl(Module callerModule, Module module, String baseName, Locale locale, ResourceBundle.Control control);
static native ResourceBundle getBundleImpl(Module callerModule, Module module, String baseName, Locale locale, ResourceBundle.Control control);

@Alias
static native Control getDefaultControl(Module targetModule, String baseName);
}

@TargetClass(className = "java.util.ResourceBundle$1")
final class Target_java_util_ResourceBundle_1 {
@Substitute
@SuppressWarnings("static-method")
public ResourceBundle getBundle(String baseName, Locale locale, Module module) {
// use the given module as the caller to bypass the access check
return MissingRegistrationUtils.runIgnoringMissingRegistrations(() -> Target_java_util_ResourceBundle.getBundleImpl(module, module,
baseName, locale,
Target_java_util_ResourceBundle.getDefaultControl(module, baseName)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
import com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl;
import com.oracle.svm.hosted.reflect.ReflectionDataBuilder;

/**
* For annotations that are materialized at image run time, all necessary methods are registered for
* reflection in {@link ReflectionDataBuilder#registerTypesForAnnotation}. But if an annotation type
* is only used by an annotation that is already in the image heap, then we need to also register
* its methods for reflection. This is done here by registering a callback which notifies us for
* every reachable {@link Annotation} object in the heap and then checking if it is an annotation
* that was materialized by the JDK, i.e., it is a {@link Proxy}.
*/
@AutomaticallyRegisteredFeature
public class AnnotationFeature implements InternalFeature {

Expand All @@ -49,14 +57,6 @@ public void duringSetup(DuringSetupAccess a) {
access.registerObjectReachableCallback(Annotation.class, this::registerDeclaredMethods);
}

/**
* For annotations that are materialized at image run time, all necessary methods are registered
* for reflection in {@link ReflectionDataBuilder#registerTypesForAnnotation}. But if an
* annotation type is only used by an annotation that is already in the image heap, then we need
* to also register its methods for reflection. This is done here by registering a callback
* which notifies us for every reachable {@link Annotation} object in the heap and then checking
* if it is an annotation that was materialized by the JDK, i.e., it is a {@link Proxy}.
*/
@SuppressWarnings("unused")
private void registerDeclaredMethods(DuringAnalysisAccess access, Annotation annotation, ObjectScanner.ScanReason reason) {
if (Proxy.isProxyClass(annotation.getClass())) {
Expand Down