< prev index next >
src/jdk.jextract/share/classes/com/sun/tools/jextract/TypeDictionary.java
Print this page
*** 42,58 ****
* A dictionary that find Java type for a given native type.
* Each instance of TypeDictionary presents types for a given java package.
*/
final class TypeDictionary {
private final Logger logger = Logger.getLogger(getClass().getPackage().getName());
! private Context ctx;
private final HeaderFile headerFile;
private final Map<String, JType> functionalTypes;
private int serialNo;
! TypeDictionary(Context ctx, HeaderFile headerFile) {
! this.ctx = ctx;
this.headerFile = headerFile;
functionalTypes = new HashMap<>();
}
private int serialNo() {
--- 42,58 ----
* A dictionary that find Java type for a given native type.
* Each instance of TypeDictionary presents types for a given java package.
*/
final class TypeDictionary {
private final Logger logger = Logger.getLogger(getClass().getPackage().getName());
! private HeaderResolver resolver;
private final HeaderFile headerFile;
private final Map<String, JType> functionalTypes;
private int serialNo;
! TypeDictionary(HeaderResolver resolver, HeaderFile headerFile) {
! this.resolver = resolver;
this.headerFile = headerFile;
functionalTypes = new HashMap<>();
}
private int serialNo() {
*** 61,71 ****
private String recordOwnerClass(Type t) {
try {
//try resolve globally
Path p = t.getDeclarationCursor().getSourceLocation().getFileLocation().path();
! HeaderFile hf = ctx.headerFor(p);
return Utils.toInternalName(hf.pkgName, hf.clsName);
} catch (Throwable ex) {
//fallback: resolve locally. This can happen for two reasons: (i) the symbol to be resolved is a builtin
//symbol (e.g. no header file has its definition), or (ii) when the declaration cursor points to an header file
//not previously seen by Context.
--- 61,71 ----
private String recordOwnerClass(Type t) {
try {
//try resolve globally
Path p = t.getDeclarationCursor().getSourceLocation().getFileLocation().path();
! HeaderFile hf = resolver.headerFor(p);
return Utils.toInternalName(hf.pkgName, hf.clsName);
} catch (Throwable ex) {
//fallback: resolve locally. This can happen for two reasons: (i) the symbol to be resolved is a builtin
//symbol (e.g. no header file has its definition), or (ii) when the declaration cursor points to an header file
//not previously seen by Context.
< prev index next >