< prev index next >
src/jdk.jextract/share/classes/com/sun/tools/jextract/HeaderResolver.java
Print this page
@@ -36,14 +36,16 @@
// The folder path mapping to package name
private final Map<Path, String> pkgMap = new LinkedHashMap<>();
// The header file parsed
private final Map<Path, HeaderFile> headerMap = new LinkedHashMap<>();
private final Log log;
+ private final Path builtinHeader;
public HeaderResolver(Context ctx) {
this.log = ctx.log;
usePackageForFolder(Context.getBuiltinHeadersDir(), "clang_support");
+ this.builtinHeader = Context.getBuiltinHeaderFile();
ctx.sources.stream()
.map(Path::getParent)
.forEach(p -> usePackageForFolder(p, ctx.options.targetPackage));
ctx.options.pkgMappings.forEach(this::usePackageForFolder);
}
@@ -142,8 +144,12 @@
final HeaderPath hp = resolveHeaderPath(header);
return new HeaderFile(this, header, hp.pkg, hp.headerCls, hp.forwarderCls);
}
public HeaderFile headerFor(Path path) {
+ if (path == null) {
+ path = builtinHeader;
+ }
+
return headerMap.computeIfAbsent(path.normalize().toAbsolutePath(), this::getHeaderFile);
}
}
< prev index next >