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 11, 2024
1 parent 6dc9495 commit 29067f5
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 nativeAccessAttrName = mainAttributes.getValue("Enable-Native-Access");
if (nativeAccessAttrName != null) {
if (!ALL_UNNAMED.equals(nativeAccessAttrName)) {
throw NativeImage.showError("illegal value \"" + nativeAccessAttrName + "\" for " + nativeAccessAttrName + " manifest attribute. Only " + ALL_UNNAMED + " is allowed");
}
addImageBuilderJavaArgs("--enable-native-access=" + ALL_UNNAMED);
}
}

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 29067f5

Please sign in to comment.