< prev index next >
src/jdk.jextract/share/classes/com/sun/tools/jextract/JType.java
Print this page
*** 188,197 ****
--- 188,201 ----
ArrayType(JType type) {
elementType = type;
}
+ PointerType asPointer() {
+ return new PointerType(elementType);
+ }
+
@Override
public String getDescriptor() {
return JType.of(java.foreign.memory.Array.class).getDescriptor();
}
*** 226,238 ****
--- 230,255 ----
Function(java.foreign.layout.Function layout, boolean isVarArgs, JType returnType, JType... args) {
this.layout = layout;
this.returnType = returnType;
this.args = args;
+ for (int i = 0; i < args.length; i++) {
+ args[i] = arrayAsPointer(args[i]);
+ }
this.isVarArgs = isVarArgs;
}
+ private static JType arrayAsPointer(JType t) {
+ if (t instanceof JType2) {
+ t = ((JType2)t).getDelegate();
+ }
+ if (t instanceof TypeAlias) {
+ t = ((TypeAlias)t).canonicalType();
+ }
+ return t instanceof ArrayType? ((ArrayType)t).asPointer() : t;
+ }
+
@Override
public String getDescriptor() {
StringBuilder sb = new StringBuilder();
sb.append('(');
// ensure sequence
< prev index next >