Skip to content

Commit

Permalink
Handle Enable-Native-Access manifest attribute if present
Browse files Browse the repository at this point in the history
Closes #10008
  • Loading branch information
zakkak committed Dec 9, 2024
1 parent 2e0e746 commit 8fd44ef
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ static boolean processJarManifestMainAttributes(Path jarFilePath, BiConsumer<Pat
void handleManifestFileAttributes(Path jarFilePath, Attributes mainAttributes) {
handleMainClassAttribute(jarFilePath, mainAttributes);
handleModuleAttributes(mainAttributes);
handleEnableNativeAccessAttribute(mainAttributes);
}

void handleMainClassAttribute(Path jarFilePath, Attributes mainAttributes) {
Expand All @@ -1078,6 +1079,16 @@ void handleModuleAttributes(Attributes mainAttributes) {
}
}

void handleEnableNativeAccessAttribute(Attributes mainAttributes) {
String enableNativeAccess = mainAttributes.getValue("Enable-Native-Access");
if (enableNativeAccess != null) {
if (!"ALL-UNNAMED".equals(enableNativeAccess)) {
NativeImage.showError("illegal value \"" + enableNativeAccess + "\" for Enable-Native-Access manifest attribute. Only ALL-UNNAMED is allowed");
}
addImageBuilderJavaArgs("--enable-native-access=" + enableNativeAccess);
}
}

void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath, Attributes mainAttributes) {
String classPathValue = mainAttributes.getValue("Class-Path");
/* Missing Class-Path Attribute is tolerable */
Expand Down

0 comments on commit 8fd44ef

Please sign in to comment.