Skip to content

Commit f6bc531

Browse files
zakkakzapster
authored andcommitted
Handle Enable-Native-Access manifest attribute if present
Closes #10008
1 parent 643e28d commit f6bc531

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

+11
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ static boolean processJarManifestMainAttributes(Path jarFilePath, BiConsumer<Pat
10551055
void handleManifestFileAttributes(Path jarFilePath, Attributes mainAttributes) {
10561056
handleMainClassAttribute(jarFilePath, mainAttributes);
10571057
handleModuleAttributes(mainAttributes);
1058+
handleEnableNativeAccessAttribute(mainAttributes);
10581059
}
10591060

10601061
void handleMainClassAttribute(Path jarFilePath, Attributes mainAttributes) {
@@ -1078,6 +1079,16 @@ void handleModuleAttributes(Attributes mainAttributes) {
10781079
}
10791080
}
10801081

1082+
void handleEnableNativeAccessAttribute(Attributes mainAttributes) {
1083+
String nativeAccessAttrName = mainAttributes.getValue("Enable-Native-Access");
1084+
if (nativeAccessAttrName != null) {
1085+
if (!ALL_UNNAMED.equals(nativeAccessAttrName)) {
1086+
throw NativeImage.showError("illegal value \"" + nativeAccessAttrName + "\" for " + nativeAccessAttrName + " manifest attribute. Only " + ALL_UNNAMED + " is allowed");
1087+
}
1088+
addImageBuilderJavaArgs("--enable-native-access=" + ALL_UNNAMED);
1089+
}
1090+
}
1091+
10811092
void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath, Attributes mainAttributes) {
10821093
String classPathValue = mainAttributes.getValue("Class-Path");
10831094
/* Missing Class-Path Attribute is tolerable */

0 commit comments

Comments
 (0)