--- old/doc/panama_foreign.md 2019-04-09 23:53:52.000000000 +0530 +++ new/doc/panama_foreign.md 2019-04-09 23:53:52.000000000 +0530 @@ -48,13 +48,13 @@ import java.foreign.memory.Pointer; // import jextracted python 'header' classes -import static org.python.Python_h.*; -import static org.python.pythonrun_h.*; +import static org.python.Python_lib.*; +import static org.python.pythonrun_lib.*; public class PythonMain { public static void main(String[] args) { Py_Initialize(); - try (Scope s = org.python.Python_h.scope().fork()) { + try (Scope s = org.python.Python_lib.scope().fork()) { PyRun_SimpleStringFlags(s.allocateCString( "print(sum([33, 55, 66])); print('Hello from Python!')\n"), Pointer.ofNull()); @@ -168,8 +168,8 @@ import java.lang.invoke.*; import java.foreign.*; import java.foreign.memory.*; -import org.sqlite.sqlite3.*; -import static org.sqlite.sqlite3_h.*; +import org.sqlite.sqlite3_h.*; +import static org.sqlite.sqlite3_lib.*; public class SqliteMain { public static void main(String[] args) throws Exception { @@ -353,9 +353,9 @@ import blas.cblas; -import static blas.cblas_h.*; -import static blas.cblas_h.CBLAS_ORDER.*; -import static blas.cblas_h.CBLAS_TRANSPOSE.*; +import static blas.cblas_lib.*; +import static blas.cblas_lib.CBLAS_ORDER.*; +import static blas.cblas_lib.CBLAS_TRANSPOSE.*; import java.foreign.NativeTypes; import java.foreign.Scope; @@ -363,8 +363,8 @@ public class TestBlas { public static void main(String[] args) { - @cblas.CBLAS_ORDER int Layout; - @cblas.CBLAS_TRANSPOSE int transa; + @blas.cblas_h.CBLAS_ORDER int Layout; + @blas.cblas_h.CBLAS_TRANSPOSE int transa; double alpha, beta; int m, n, lda, incx, incy, i; @@ -457,14 +457,14 @@ import java.foreign.Scope; import java.foreign.memory.Array; -import static lapack.clapack_h.*; -import static lapack.cblas_h.*; +import static lapack.clapack_lib.*; +import static lapack.cblas_lib.*; public class TestLapack { public static void main(String[] args) { /* Locals */ - try (Scope sc = lapack.clapack_h.scope().fork()) { + try (Scope sc = lapack.clapack_lib.scope().fork()) { Array A = sc.allocateArray(NativeTypes.DOUBLE, new double[]{ 1, 2, 3, 4, 5, 1, 3, 5, 2, 4, 1, 4, 2, 5, 3 }); @@ -540,7 +540,7 @@ import java.foreign.Scope; import java.foreign.memory.Array; -import static lapack.lapacke_h.*; +import static lapack.lapacke_lib.*; public class TestLapack { public static void main(String[] args) { @@ -615,7 +615,7 @@ import java.foreign.*; import java.foreign.memory.*; -import static org.unix.libproc_h.*; +import static org.unix.libproc_lib.*; public class LibprocMain { private static final int NAME_BUF_MAX = 256; @@ -676,7 +676,7 @@ import java.foreign.*; import java.foreign.memory.*; -import static org.unix.readline_h.*; +import static org.unix.readline_lib.*; public class Readline { public static void main(String[] args) { @@ -725,14 +725,13 @@ import java.lang.invoke.*; import java.foreign.*; import java.foreign.memory.*; -import org.unix.curl.*; -import org.unix.curl_h; -import static org.unix.curl_h.*; -import static org.unix.easy_h.*; +import org.unix.curl_lib; +import static org.unix.curl_lib.*; +import static org.unix.easy_lib.*; public class CurlMain { public static void main(String[] args) { - try (Scope s = curl_h.scope().fork()) { + try (Scope s = curl_lib.scope().fork()) { curl_global_init(CURL_GLOBAL_DEFAULT); Pointer curl = curl_easy_init(); if(!curl.isNull()) { @@ -775,13 +774,13 @@ import java.foreign.*; import java.lang.invoke.*; -import org.unix.unistd; +import org.unix.unistd_h; public class Getpid { public static void main(String[] args) { // bind unistd interface - var u = Libraries.bind(MethodHandles.lookup(), unistd.class); + var u = Libraries.bind(MethodHandles.lookup(), unistd_h.class); // call getpid from the unistd.h System.out.println(u.getpid()); // check process id from Java API! @@ -840,8 +839,8 @@ import java.foreign.memory.Array; import java.foreign.memory.Pointer; -import static opengl.gl_h.*; -import static opengl.freeglut_std_h.*; +import static opengl.gl_lib.*; +import static opengl.freeglut_std_lib.*; public class Teapot { @@ -884,7 +883,7 @@ } public static void main(String[] args) { - try (Scope sc = opengl.gl_h.scope().fork()) { + try (Scope sc = opengl.gl_lib.scope().fork()) { Pointer argc = sc.allocate(NativeTypes.INT32); argc.set(0); glutInit(argc, Pointer.ofNull()); @@ -1000,18 +999,18 @@ import java.foreign.memory.Array; import java.foreign.memory.LayoutType; import java.foreign.memory.Pointer; -import org.tensorflow.panama.c_api.TF_DataType; -import org.tensorflow.panama.c_api.TF_Graph; -import org.tensorflow.panama.c_api.TF_Operation; -import org.tensorflow.panama.c_api.TF_OperationDescription; -import org.tensorflow.panama.c_api.TF_Output; -import org.tensorflow.panama.c_api.TF_Session; -import org.tensorflow.panama.c_api.TF_SessionOptions; -import org.tensorflow.panama.c_api.TF_Status; -import org.tensorflow.panama.c_api.TF_Tensor; +import org.tensorflow.panama.c_api_h.TF_DataType; +import org.tensorflow.panama.c_api_h.TF_Graph; +import org.tensorflow.panama.c_api_h.TF_Operation; +import org.tensorflow.panama.c_api_h.TF_OperationDescription; +import org.tensorflow.panama.c_api_h.TF_Output; +import org.tensorflow.panama.c_api_h.TF_Session; +import org.tensorflow.panama.c_api_h.TF_SessionOptions; +import org.tensorflow.panama.c_api_h.TF_Status; +import org.tensorflow.panama.c_api_h.TF_Tensor; -import static org.tensorflow.panama.c_api_h.*; -import static org.tensorflow.panama.c_api_h.TF_DataType.*; +import static org.tensorflow.panama.c_api_lib.*; +import static org.tensorflow.panama.c_api_lib.TF_DataType.*; public class TensorFlowExample { static Pointer PlaceHolder(Pointer graph, Pointer status, --- old/src/jdk.jextract/share/classes/com/sun/tools/jextract/HeaderResolver.java 2019-04-09 23:53:55.000000000 +0530 +++ new/src/jdk.jextract/share/classes/com/sun/tools/jextract/HeaderResolver.java 2019-04-09 23:53:54.000000000 +0530 @@ -50,14 +50,18 @@ ctx.options.pkgMappings.forEach(this::usePackageForFolder); } - public String headerInterfaceName(String filename) { + private static String safeFileName(String filename) { int ext = filename.lastIndexOf('.'); String name = ext != -1 ? filename.substring(0, ext) : filename; return Utils.toClassName(name); } - public String staticForwarderName(String filename) { - return headerInterfaceName(filename) + "_h"; + public static String headerInterfaceName(String filename) { + return safeFileName(filename) + "_h"; + } + + public static String staticForwarderName(String filename) { + return safeFileName(filename) + "_lib"; } private void usePackageForFolder(Path folder, String pkg) { --- old/test/jdk/com/sun/tools/jextract/JextractToolRunner.java 2019-04-09 23:53:57.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/JextractToolRunner.java 2019-04-09 23:53:56.000000000 +0530 @@ -44,14 +44,18 @@ import static org.testng.Assert.fail; public class JextractToolRunner { - // utilities to avoid hard-coding generated class, interface names everywhere - public static String headerInterfaceName(String filename) { + private static String safeFileName(String filename) { int ext = filename.lastIndexOf('.'); return ext != -1 ? filename.substring(0, ext) : filename; } + // utilities to avoid hard-coding generated class, interface names everywhere + public static String headerInterfaceName(String filename) { + return safeFileName(filename) + "_h"; + } + public static String staticForwarderName(String filename) { - return headerInterfaceName(filename) + "_h"; + return safeFileName(filename) + "_lib"; } // struct, enum and callback interfaces are nested types of header interface --- old/test/jdk/com/sun/tools/jextract/Runner.java 2019-04-09 23:54:01.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/Runner.java 2019-04-09 23:54:00.000000000 +0530 @@ -339,12 +339,12 @@ @DataProvider(name = "cases") public static Object[][] cases() { return new Object[][] { - { "simple.h", "com.acme", new String[] { "simple.java" }, true}, - { "recursive.h", "com.acme", new String[] { "recursive.java" }, false}, - { "TypedefAnonStruct.h", "com.acme", new String[] { "TypedefAnonStruct.java" }, false}, - { "pad.h", "com.acme", new String[] { "pad.java" }, false}, - { "bitfields.h", "com.acme", new String[] { "bitfields.java" }, true}, - { "globalFuncPointer.h", "com.acme", new String[] { "globalFuncPointer.java" }, false} + { "simple.h", "com.acme", new String[] { "simple_h.java" }, true}, + { "recursive.h", "com.acme", new String[] { "recursive_h.java" }, false}, + { "TypedefAnonStruct.h", "com.acme", new String[] { "TypedefAnonStruct_h.java" }, false}, + { "pad.h", "com.acme", new String[] { "pad_h.java" }, false}, + { "bitfields.h", "com.acme", new String[] { "bitfields_h.java" }, true}, + { "globalFuncPointer.h", "com.acme", new String[] { "globalFuncPointer_h.java" }, false} }; } } --- old/test/jdk/com/sun/tools/jextract/complex/ComplexTest.java 2019-04-09 23:54:04.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/complex/ComplexTest.java 2019-04-09 23:54:03.000000000 +0530 @@ -31,8 +31,8 @@ import java.lang.invoke.MethodHandles; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import org.c99.libcomplex_aux; -import org.c99.mycomplex; +import org.c99.libcomplex_aux_h; +import org.c99.mycomplex_h; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -56,14 +56,14 @@ private static final double TOLERANCE = 0.0001; private static final float TOLERANCEF = 0.0001f; - private mycomplex comlib; - private libcomplex_aux auxlib; + private mycomplex_h comlib; + private libcomplex_aux_h auxlib; @BeforeTest public void init() { - comlib = Libraries.bind(MethodHandles.lookup(), mycomplex.class); + comlib = Libraries.bind(MethodHandles.lookup(), mycomplex_h.class); Library l = Libraries.loadLibrary(MethodHandles.lookup(), "complex_aux"); - auxlib = Libraries.bind(libcomplex_aux.class, l); + auxlib = Libraries.bind(libcomplex_aux_h.class, l); } @Test --- old/test/jdk/com/sun/tools/jextract/incompleteArrays/IncompleteArrayTest.java 2019-04-09 23:54:08.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/incompleteArrays/IncompleteArrayTest.java 2019-04-09 23:54:07.000000000 +0530 @@ -83,7 +83,7 @@ .checkMatchesOutput(".*WARNING: can not compute layout for type .+" + " with flexible array member\\. Emitting undefined layout reference\\..*"); try (Loader loader = classLoader(jar)) { - assertNotNull(loader.loadClass(headerInterfaceName("incompleteArray3i.h"))); + assertNotNull(loader.loadClass(headerInterfaceName("incompleteArray3.h"))); } finally { deleteFile(jar); } --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Cursor.java 2019-04-09 23:54:12.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Cursor.java 2019-04-09 23:54:11.000000000 +0530 @@ -23,12 +23,9 @@ package jdk.internal.clang; -import clang.*; -import clang.Index; - -import static clang.Index.CXCursor; -import static clang.Index.CXSourceLocation; -import static clang.Index.CXSourceRange; +import static clang.Index_h.CXCursor; +import static clang.Index_h.CXSourceLocation; +import static clang.Index_h.CXSourceRange; import java.foreign.memory.Pointer; import java.foreign.Scope; --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Index.java 2019-04-09 23:54:17.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Index.java 2019-04-09 23:54:16.000000000 +0530 @@ -30,8 +30,8 @@ import java.util.List; import java.util.function.Consumer; -import clang.Index.CXTranslationUnitImpl; -import clang.Index.CXDiagnostic; +import clang.Index_h.CXTranslationUnitImpl; +import clang.Index_h.CXDiagnostic; public class Index { // Pointer to CXIndex @@ -45,7 +45,7 @@ } public TranslationUnit parseTU(String file, String... args) { - final clang.Index lclang = LibClang.lib; + final clang.Index_h lclang = LibClang.lib; try (Scope scope = Scope.globalScope().fork()) { Pointer src = scope.allocateCString(file); @@ -58,7 +58,7 @@ } public Cursor parse(String file, Consumer eh, boolean detailedPreprocessorRecord, String... args) { - final clang.Index lclang = LibClang.lib; + final clang.Index_h lclang = LibClang.lib; try (Scope scope = Scope.globalScope().fork()) { Pointer src = scope.allocateCString(file); --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/LibClang.java 2019-04-09 23:54:21.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/LibClang.java 2019-04-09 23:54:20.000000000 +0530 @@ -22,7 +22,7 @@ */ package jdk.internal.clang; -import clang.CXString.CXString; +import clang.CXString_h.CXString; import java.foreign.Libraries; import java.foreign.Library; @@ -33,8 +33,8 @@ public class LibClang { private static final boolean DEBUG = Boolean.getBoolean("libclang.debug"); - static final clang.Index lib; - private static final clang.CXString lcxstr; + static final clang.Index_h lib; + private static final clang.CXString_h lcxstr; static { if (DEBUG) { @@ -44,8 +44,8 @@ ? "libclang" : "clang"; Library libclang = Libraries.loadLibrary(MethodHandles.lookup(), libName); - lib = Libraries.bind(clang.Index.class, libclang); - lcxstr = Libraries.bind(clang.CXString.class, libclang); + lib = Libraries.bind(clang.Index_h.class, libclang); + lcxstr = Libraries.bind(clang.CXString_h.class, libclang); } public static Index createIndex(boolean local) { --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/SourceLocation.java 2019-04-09 23:54:25.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/SourceLocation.java 2019-04-09 23:54:24.000000000 +0530 @@ -29,8 +29,8 @@ import java.nio.file.Paths; import java.util.Objects; -import static clang.CXString.CXString; -import static clang.Index.CXSourceLocation; +import static clang.CXString_h.CXString; +import static clang.Index_h.CXSourceLocation; public class SourceLocation { --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/SourceRange.java 2019-04-09 23:54:26.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/SourceRange.java 2019-04-09 23:54:26.000000000 +0530 @@ -23,8 +23,8 @@ package jdk.internal.clang; import java.nio.ByteBuffer; -import static clang.Index.CXSourceLocation; -import static clang.Index.CXSourceRange; +import static clang.Index_h.CXSourceLocation; +import static clang.Index_h.CXSourceRange; public class SourceRange { final CXSourceRange range; --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/TranslationUnit.java 2019-04-09 23:54:28.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/TranslationUnit.java 2019-04-09 23:54:27.000000000 +0530 @@ -32,11 +32,11 @@ import java.io.IOException; import java.nio.file.Path; -import clang.CXString.CXString; -import clang.Index.CXDiagnostic; -import clang.Index.CXToken; -import clang.Index.CXTokenKind; -import clang.Index.CXTranslationUnitImpl; +import clang.CXString_h.CXString; +import clang.Index_h.CXDiagnostic; +import clang.Index_h.CXToken; +import clang.Index_h.CXTokenKind; +import clang.Index_h.CXTranslationUnitImpl; public class TranslationUnit { private final Pointer tu; @@ -51,7 +51,7 @@ } public Diagnostic[] getDiagnostics() { - final clang.Index lclang = LibClang.lib; + final clang.Index_h lclang = LibClang.lib; int cntDiags = lclang.clang_getNumDiagnostics(tu); if (cntDiags == 0) { --- old/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Type.java 2019-04-09 23:54:30.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/jclang-ffi/src/jdk/internal/clang/Type.java 2019-04-09 23:54:29.000000000 +0530 @@ -23,7 +23,7 @@ package jdk.internal.clang; -import clang.Index.CXType; +import clang.Index_h.CXType; import java.foreign.Scope; import java.foreign.memory.Pointer; --- old/test/jdk/com/sun/tools/jextract/missing/MissingSymbolTest.java 2019-04-09 23:54:31.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/missing/MissingSymbolTest.java 2019-04-09 23:54:30.000000000 +0530 @@ -26,10 +26,9 @@ import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import org.testng.annotations.Test; -import test.jextract.missing.missing; +import test.jextract.missing.missing_h; import static org.testng.Assert.assertTrue; -import static test.jextract.missing.missing.*; /* * @test @@ -42,12 +41,12 @@ public void testBind() { // make sure that we can bind even though "cube" method is missing! Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "Missing"); - missing libMissing = Libraries.bind(missing.class, lib); + missing_h libMissing = Libraries.bind(missing_h.class, lib); // make sure cube method is not present boolean noCubeMethod = false; try { - Method cube = missing.class.getMethod("cube", int.class); + Method cube = missing_h.class.getMethod("cube", int.class); } catch (NoSuchMethodException nsme) { System.err.println(nsme); noCubeMethod = true; --- old/test/jdk/com/sun/tools/jextract/staticForwarder/StaticForwarderTest.java 2019-04-09 23:54:32.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/staticForwarder/StaticForwarderTest.java 2019-04-09 23:54:32.000000000 +0530 @@ -26,7 +26,7 @@ import java.foreign.Scope; import static org.testng.Assert.assertEquals; -import static test.jextract.utils.utils_h.*; +import static test.jextract.utils.utils_lib.*; /* * @test --- old/test/jdk/com/sun/tools/jextract/test8218679/StrGlobalsTest.java 2019-04-09 23:54:33.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/test8218679/StrGlobalsTest.java 2019-04-09 23:54:33.000000000 +0530 @@ -26,7 +26,7 @@ import java.foreign.memory.Pointer; import java.lang.invoke.MethodHandles; import org.testng.annotations.Test; -import test.jextract.strglobals.strglobals; +import test.jextract.strglobals.strglobals_h; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; @@ -40,11 +40,11 @@ * @run testng StrGlobalsTest */ public class StrGlobalsTest { - static final strglobals libGlobals; + static final strglobals_h libGlobals; static { Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "Strglobals"); - libGlobals = Libraries.bind(strglobals.class, lib); + libGlobals = Libraries.bind(strglobals_h.class, lib); } @Test --- old/test/jdk/com/sun/tools/jextract/test8219194/VoidCastTest.java 2019-04-09 23:54:34.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/test8219194/VoidCastTest.java 2019-04-09 23:54:34.000000000 +0530 @@ -27,7 +27,7 @@ import java.foreign.memory.Pointer; import java.lang.invoke.MethodHandles; import org.testng.annotations.Test; -import test.jextract.voidcast.voidcast; +import test.jextract.voidcast.voidcast_h; import static org.testng.Assert.assertTrue; @@ -40,11 +40,11 @@ * @run testng VoidCastTest */ public class VoidCastTest { - static final voidcast libCast; + static final voidcast_h libCast; static { Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "Voidcast"); - libCast = Libraries.bind(voidcast.class, lib); + libCast = Libraries.bind(voidcast_h.class, lib); } @Test --- old/test/jdk/com/sun/tools/jextract/test8221838/StructTypedefsTest.java 2019-04-09 23:54:36.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/test8221838/StructTypedefsTest.java 2019-04-09 23:54:35.000000000 +0530 @@ -23,7 +23,7 @@ import java.foreign.memory.Pointer; import org.testng.annotations.Test; -import static test8221838.structtypedefs_h.*; +import static test8221838.structtypedefs_lib.*; /* * @test --- old/test/jdk/com/sun/tools/jextract/test8222025/ValistUseTest.java 2019-04-09 23:54:37.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/test8222025/ValistUseTest.java 2019-04-09 23:54:36.000000000 +0530 @@ -32,6 +32,7 @@ * @bug 8222025 * @summary jextract generates reference to underfined type for va_list * @library .. + * @requires os.family != "windows" * @run testng ValistUseTest */ public class ValistUseTest extends JextractToolRunner { @@ -44,7 +45,7 @@ va_list_use_H.toString()).checkSuccess(); try { Loader loader = classLoader(vaListUseJar); - Class vaListTag = loader.loadClass("clang_support.builtin$$__va_list_tag"); + Class vaListTag = loader.loadClass("clang_support.builtin$_h$__va_list_tag"); assertTrue(vaListTag != null); } finally { deleteFile(vaListUseJar); --- old/test/jdk/com/sun/tools/jextract/testArrayFuncParam/FuncArrayParamTest.java 2019-04-09 23:54:38.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/testArrayFuncParam/FuncArrayParamTest.java 2019-04-09 23:54:38.000000000 +0530 @@ -31,8 +31,8 @@ import java.util.Arrays; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import test.arrayparam.funcArrayParam; -import test.arrayparam.funcArrayParam.FPPtrFieldStruct; +import test.arrayparam.funcArrayParam_h; +import test.arrayparam.funcArrayParam_h.FPPtrFieldStruct; import static org.testng.Assert.assertEquals; @@ -44,12 +44,12 @@ * @run testng FuncArrayParamTest */ public class FuncArrayParamTest { - private funcArrayParam fap; + private funcArrayParam_h fap; @BeforeTest public void init() { Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "FuncArrayParam"); - fap = Libraries.bind(funcArrayParam.class, lib); + fap = Libraries.bind(funcArrayParam_h.class, lib); } private static int[] jarr = new int[] { 34, 66, 23, 53, 345 }; --- old/test/jdk/com/sun/tools/jextract/testEnum/LibEnumsTest.java 2019-04-09 23:54:39.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/testEnum/LibEnumsTest.java 2019-04-09 23:54:39.000000000 +0530 @@ -26,10 +26,10 @@ import java.lang.invoke.MethodHandles; import java.util.List; import org.testng.annotations.Test; -import test.jextract.enums.enums; +import test.jextract.enums.enums_h; import static org.testng.Assert.assertEquals; -import static test.jextract.enums.enums_h.*; +import static test.jextract.enums.enums_lib.*; /* * @test @@ -40,11 +40,11 @@ * @run testng LibEnumsTest */ public class LibEnumsTest { - static final enums libEnums; + static final enums_h libEnums; static { Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "Enums"); - libEnums = Libraries.bind(enums.class, lib); + libEnums = Libraries.bind(enums_h.class, lib); } @Test --- old/test/jdk/com/sun/tools/jextract/testStruct/LibStructTest.java 2019-04-09 23:54:41.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/testStruct/LibStructTest.java 2019-04-09 23:54:40.000000000 +0530 @@ -29,11 +29,11 @@ import java.foreign.memory.Pointer; import java.lang.invoke.MethodHandles; import org.testng.annotations.Test; -import test.jextract.struct.struct; +import test.jextract.struct.struct_h; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; -import static test.jextract.struct.struct.*; +import static test.jextract.struct.struct_h.*; /* * @test @@ -42,11 +42,11 @@ * @run testng LibStructTest */ public class LibStructTest { - static final struct libStruct; + static final struct_h libStruct; static { Library lib = Libraries.loadLibrary(MethodHandles.lookup(), "Struct"); - libStruct = Libraries.bind(struct.class, lib); + libStruct = Libraries.bind(struct_h.class, lib); } @Test --- old/test/jdk/com/sun/tools/jextract/unresolved/TestResolve.java 2019-04-09 23:54:42.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/unresolved/TestResolve.java 2019-04-09 23:54:42.000000000 +0530 @@ -24,8 +24,8 @@ import org.testng.annotations.*; import static org.testng.Assert.*; -import org.test.Foo; -import org.test.Bar; +import org.test_h.Foo; +import org.test_h.Bar; import java.foreign.Scope; --- old/test/jdk/com/sun/tools/jextract/unresolved/TestResolveCrossHeader.java 2019-04-09 23:54:43.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/unresolved/TestResolveCrossHeader.java 2019-04-09 23:54:43.000000000 +0530 @@ -24,8 +24,8 @@ import org.testng.annotations.*; import static org.testng.Assert.*; -import org.a.Foo; -import org.b.Bar; +import org.a_h.Foo; +import org.b_h.Bar; import java.foreign.Scope; --- /dev/null 2019-04-09 23:54:45.000000000 +0530 +++ new/src/jdk.jextract/share/conf/builtin$.h 2019-04-09 23:54:44.000000000 +0530 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// Dummy header file for clang compiler builtins --- old/test/jdk/com/sun/tools/jextract/compare/TypedefAnonStruct.java 2019-04-09 23:54:46.000000000 +0530 +++ /dev/null 2019-04-09 23:54:46.000000000 +0530 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeLocation; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Struct; -import java.foreign.memory.Pointer; - -@NativeHeader(path="TypedefAnonStruct.h") -public interface TypedefAnonStruct { - @NativeLocation( - file="TypedefAnonStruct.h", line=24, column=9 - ) - @NativeStruct("[" + - "i32(i)" + - "i32(j)" + - "](Point)") - public static interface Point extends Struct { - @NativeLocation( - file="TypedefAnonStruct.h", line=25, column=9 - ) - @NativeGetter("i") - public int i$get(); - @NativeSetter("i") - public void i$set(int arg); - @NativeAddressof("i") - public Pointer i$ptr(); - @NativeLocation( - file="TypedefAnonStruct.h", line=25, column=12 - ) - @NativeGetter("j") - public int j$get(); - @NativeSetter("j") - public void j$set(int arg); - @NativeAddressof("j") - public Pointer j$ptr(); - } - - @NativeLocation( - file="TypedefAnonStruct.h", line=28, column=9 - ) - @NativeStruct("[" + - "f32(x)" + - "f32(y)" + - "](FPoint)") - public static interface FPoint extends Struct { - @NativeLocation( - file="TypedefAnonStruct.h", line=29, column=11 - ) - @NativeGetter("x") - public float x$get(); - @NativeSetter("x") - public void x$set(float arg); - @NativeAddressof("x") - public Pointer x$ptr(); - @NativeLocation( - file="TypedefAnonStruct.h", line=29, column=14 - ) - @NativeGetter("y") - public float y$get(); - @NativeSetter("y") - public void y$set(float arg); - @NativeAddressof("y") - public Pointer y$ptr(); - } -} --- /dev/null 2019-04-09 23:54:46.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/TypedefAnonStruct_h.java 2019-04-09 23:54:45.000000000 +0530 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeLocation; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Struct; +import java.foreign.memory.Pointer; + +@NativeHeader(path="TypedefAnonStruct.h") +public interface TypedefAnonStruct_h { + @NativeLocation( + file="TypedefAnonStruct.h", line=24, column=9 + ) + @NativeStruct("[" + + "i32(i)" + + "i32(j)" + + "](Point)") + public static interface Point extends Struct { + @NativeLocation( + file="TypedefAnonStruct.h", line=25, column=9 + ) + @NativeGetter("i") + public int i$get(); + @NativeSetter("i") + public void i$set(int arg); + @NativeAddressof("i") + public Pointer i$ptr(); + @NativeLocation( + file="TypedefAnonStruct.h", line=25, column=12 + ) + @NativeGetter("j") + public int j$get(); + @NativeSetter("j") + public void j$set(int arg); + @NativeAddressof("j") + public Pointer j$ptr(); + } + + @NativeLocation( + file="TypedefAnonStruct.h", line=28, column=9 + ) + @NativeStruct("[" + + "f32(x)" + + "f32(y)" + + "](FPoint)") + public static interface FPoint extends Struct { + @NativeLocation( + file="TypedefAnonStruct.h", line=29, column=11 + ) + @NativeGetter("x") + public float x$get(); + @NativeSetter("x") + public void x$set(float arg); + @NativeAddressof("x") + public Pointer x$ptr(); + @NativeLocation( + file="TypedefAnonStruct.h", line=29, column=14 + ) + @NativeGetter("y") + public float y$get(); + @NativeSetter("y") + public void y$set(float arg); + @NativeAddressof("y") + public Pointer y$ptr(); + } +} --- old/test/jdk/com/sun/tools/jextract/compare/bitfields.java 2019-04-09 23:54:47.000000000 +0530 +++ /dev/null 2019-04-09 23:54:47.000000000 +0530 @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Pointer; -import java.foreign.memory.Struct; - -@NativeHeader(path="bitfields.h") -public interface bitfields { - - @NativeStruct("[" + - "u64=[" + - "i2(x)" + - "x6" + - "i15(y)" + - "x9" + - "i20(z)" + - "x12]" + - "u64=[" + - "i13(w)" + - "x51]" + - "](bitfields1)") - interface bitfields1 extends Struct { - @NativeGetter("x") - long x$get(); - @NativeSetter("x") - void x$set(long value); - @NativeGetter("y") - long y$get(); - @NativeSetter("y") - void y$set(long value); - @NativeGetter("z") - int z$get(); - @NativeSetter("z") - void z$set(int value); - @NativeGetter("w") - int w$get(); - @NativeSetter("w") - void w$set(int value); - } - - @NativeStruct("[" + - "u64=[" + - "u3(c)" + - "u3(c2)" + - "x2" + - "u7(c3)" + - "i4(i)" + - "i21(l)" + - "x24]" + - "u64=[" + - "i42(ll)" + - "x22]" + - "](bitfields2)") - interface bitfields2 extends Struct { - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - @NativeGetter("c2") - byte c2$get(); - @NativeSetter("c2") - void c2$set(byte value); - @NativeGetter("c3") - byte c3$get(); - @NativeSetter("c3") - void c3$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - @NativeGetter("ll") - long ll$get(); - @NativeSetter("ll") - void ll$set(long value); - } - - @NativeStruct("[" + - "u32=[" + - "u4(c1)" + - "i20(i)" + - "u8(c2)]" + - "u32=[" + - "i32(l1)]" + - "u32=[" + - "i32(l2)]" + - "](bitfields3)") - interface bitfields3 extends Struct { - @NativeGetter("c1") - byte c1$get(); - @NativeSetter("c1") - void c1$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeGetter("c2") - byte c2$get(); - @NativeSetter("c2") - void c2$set(byte value); - @NativeGetter("l1") - int l1$get(); - @NativeSetter("l1") - void l1$set(int value); - @NativeGetter("l2") - int l2$get(); - @NativeSetter("l2") - void l2$set(int value); - } - - @NativeStruct("[" + - "i64(l)" + - "u64=[" + - "u4(c)" + - "x60]" + - "](bitfields4)") - interface bitfields4 extends Struct { - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - @NativeAddressof("l") - Pointer l$ptr(); - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - } - - @NativeStruct("[" + - "u64=[" + - "u7(c)" + - "x57]" + - "u64=[" + - "i63(l)" + - "x1]" + - "](bitfields5)") - interface bitfields5 extends Struct { - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - } - - @NativeStruct("[" + - "u8=[" + - "u4(c1)]|" + - "i32=[" + - "i20(i)]" + - "](bitfields6)") - interface bitfields6 extends Struct { - @NativeGetter("c1") - byte c1$get(); - @NativeSetter("c1") - void c1$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - } - - @NativeStruct("[" + - "u32(x)" + - "u32=[u15(a)u17(pad)]" + - "](bitfields7)") - public interface bitfields7 extends Struct { - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int value); - @NativeAddressof("x") - Pointer x$ptr(); - @NativeGetter("a") - int a$get(); - @NativeSetter("a") - void a$set(int value); - @NativeGetter("pad") - int pad$get(); - @NativeSetter("pad") - void pad$set(int value); - } - - @NativeStruct("[" + - "i32(i)" + - "i32(j)" + - "](Point)") - public interface Point extends Struct { - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeAddressof("i") - Pointer i$ptr(); - @NativeGetter("j") - int j$get(); - @NativeSetter("j") - void j$set(int value); - @NativeAddressof("j") - Pointer j$ptr(); - } - - @NativeStruct("[" + - "${Point}(p)" + - "u32=[i12(x)i2(y)x18]" + - "](bitfields8)") - public interface bitfields8 extends Struct { - @NativeGetter("p") - Point p$get(); - @NativeSetter("p") - void p$set(Point value); - Pointer p$ptr(); - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int value); - @NativeGetter("y") - int y$get(); - @NativeSetter("y") - void y$set(int value); - } - - @NativeStruct("[" + - "u32=[u1(x)x7u8(y)x16]" + - "i32(z)" + - "](bitfields9)") - public interface bitfields9 extends Struct { - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int var1); - - @NativeGetter("y") - int y$get(); - @NativeSetter("y") - void y$set(int var1); - - @NativeGetter("z") - int z$get(); - @NativeSetter("z") - void z$set(int var1); - @NativeAddressof("z") - Pointer z$ptr(); - } - - @NativeStruct("[u32=[u1(x)]|x64](bitfields10)") - public interface bitfields10 extends Struct { - @NativeGetter("x") - int x$get(); - - @NativeSetter("x") - void x$set(int var1); - } - -} --- /dev/null 2019-04-09 23:54:47.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/bitfields_h.java 2019-04-09 23:54:47.000000000 +0530 @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Pointer; +import java.foreign.memory.Struct; + +@NativeHeader(path="bitfields.h") +public interface bitfields_h { + + @NativeStruct("[" + + "u64=[" + + "i2(x)" + + "x6" + + "i15(y)" + + "x9" + + "i20(z)" + + "x12]" + + "u64=[" + + "i13(w)" + + "x51]" + + "](bitfields1)") + interface bitfields1 extends Struct { + @NativeGetter("x") + long x$get(); + @NativeSetter("x") + void x$set(long value); + @NativeGetter("y") + long y$get(); + @NativeSetter("y") + void y$set(long value); + @NativeGetter("z") + int z$get(); + @NativeSetter("z") + void z$set(int value); + @NativeGetter("w") + int w$get(); + @NativeSetter("w") + void w$set(int value); + } + + @NativeStruct("[" + + "u64=[" + + "u3(c)" + + "u3(c2)" + + "x2" + + "u7(c3)" + + "i4(i)" + + "i21(l)" + + "x24]" + + "u64=[" + + "i42(ll)" + + "x22]" + + "](bitfields2)") + interface bitfields2 extends Struct { + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + @NativeGetter("c2") + byte c2$get(); + @NativeSetter("c2") + void c2$set(byte value); + @NativeGetter("c3") + byte c3$get(); + @NativeSetter("c3") + void c3$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + @NativeGetter("ll") + long ll$get(); + @NativeSetter("ll") + void ll$set(long value); + } + + @NativeStruct("[" + + "u32=[" + + "u4(c1)" + + "i20(i)" + + "u8(c2)]" + + "u32=[" + + "i32(l1)]" + + "u32=[" + + "i32(l2)]" + + "](bitfields3)") + interface bitfields3 extends Struct { + @NativeGetter("c1") + byte c1$get(); + @NativeSetter("c1") + void c1$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeGetter("c2") + byte c2$get(); + @NativeSetter("c2") + void c2$set(byte value); + @NativeGetter("l1") + int l1$get(); + @NativeSetter("l1") + void l1$set(int value); + @NativeGetter("l2") + int l2$get(); + @NativeSetter("l2") + void l2$set(int value); + } + + @NativeStruct("[" + + "i64(l)" + + "u64=[" + + "u4(c)" + + "x60]" + + "](bitfields4)") + interface bitfields4 extends Struct { + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + @NativeAddressof("l") + Pointer l$ptr(); + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + } + + @NativeStruct("[" + + "u64=[" + + "u7(c)" + + "x57]" + + "u64=[" + + "i63(l)" + + "x1]" + + "](bitfields5)") + interface bitfields5 extends Struct { + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + } + + @NativeStruct("[" + + "u8=[" + + "u4(c1)]|" + + "i32=[" + + "i20(i)]" + + "](bitfields6)") + interface bitfields6 extends Struct { + @NativeGetter("c1") + byte c1$get(); + @NativeSetter("c1") + void c1$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + } + + @NativeStruct("[" + + "u32(x)" + + "u32=[u15(a)u17(pad)]" + + "](bitfields7)") + public interface bitfields7 extends Struct { + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int value); + @NativeAddressof("x") + Pointer x$ptr(); + @NativeGetter("a") + int a$get(); + @NativeSetter("a") + void a$set(int value); + @NativeGetter("pad") + int pad$get(); + @NativeSetter("pad") + void pad$set(int value); + } + + @NativeStruct("[" + + "i32(i)" + + "i32(j)" + + "](Point)") + public interface Point extends Struct { + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeAddressof("i") + Pointer i$ptr(); + @NativeGetter("j") + int j$get(); + @NativeSetter("j") + void j$set(int value); + @NativeAddressof("j") + Pointer j$ptr(); + } + + @NativeStruct("[" + + "${Point}(p)" + + "u32=[i12(x)i2(y)x18]" + + "](bitfields8)") + public interface bitfields8 extends Struct { + @NativeGetter("p") + Point p$get(); + @NativeSetter("p") + void p$set(Point value); + Pointer p$ptr(); + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int value); + @NativeGetter("y") + int y$get(); + @NativeSetter("y") + void y$set(int value); + } + + @NativeStruct("[" + + "u32=[u1(x)x7u8(y)x16]" + + "i32(z)" + + "](bitfields9)") + public interface bitfields9 extends Struct { + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int var1); + + @NativeGetter("y") + int y$get(); + @NativeSetter("y") + void y$set(int var1); + + @NativeGetter("z") + int z$get(); + @NativeSetter("z") + void z$set(int var1); + @NativeAddressof("z") + Pointer z$ptr(); + } + + @NativeStruct("[u32=[u1(x)]|x64](bitfields10)") + public interface bitfields10 extends Struct { + @NativeGetter("x") + int x$get(); + + @NativeSetter("x") + void x$set(int var1); + } + +} --- old/test/jdk/com/sun/tools/jextract/compare/globalFuncPointer.java 2019-04-09 23:54:48.000000000 +0530 +++ /dev/null 2019-04-09 23:54:48.000000000 +0530 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeCallback; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeSetter; -import java.foreign.memory.Callback; -import java.foreign.memory.Pointer; - -@NativeHeader( - path="globalFuncPointer.h", - globals={"u64(fp):(*)v"} -) -public interface globalFuncPointer { - @NativeGetter("fp") - Callback fp$get(); - @NativeSetter("fp") - void fp$set(Callback fi1); - @NativeAddressof("fp") - Pointer> fp$ptr(); - - @FunctionalInterface - @NativeCallback("(*)v") - public interface FI1 { - void fn(Object...args); - } -} --- /dev/null 2019-04-09 23:54:48.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/globalFuncPointer_h.java 2019-04-09 23:54:48.000000000 +0530 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeCallback; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeSetter; +import java.foreign.memory.Callback; +import java.foreign.memory.Pointer; + +@NativeHeader( + path="globalFuncPointer.h", + globals={"u64(fp):(*)v"} +) +public interface globalFuncPointer_h { + @NativeGetter("fp") + Callback fp$get(); + @NativeSetter("fp") + void fp$set(Callback fi1); + @NativeAddressof("fp") + Pointer> fp$ptr(); + + @FunctionalInterface + @NativeCallback("(*)v") + public interface FI1 { + void fn(Object...args); + } +} --- old/test/jdk/com/sun/tools/jextract/compare/pad.java 2019-04-09 23:54:50.000000000 +0530 +++ /dev/null 2019-04-09 23:54:50.000000000 +0530 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeLocation; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Struct; - -@NativeHeader(path="pad.h") -public interface pad { - @NativeStruct( - "[" + - "u8(c1)" + - "x56" + - "[" + - "i64(l)|" + - "[" + - "u8(x1)" + - "x56" + - "f64(y1)" + - "](anon$pad_h$1123)|" + - "${anon$pad_h$1195}(p2)" + - "](anon$pad_h$1086)" + - "f32(f1)" + - "x32" + - "](PaddyStruct)") - interface PaddyStruct extends Struct { - @NativeGetter("c1") - public abstract byte c1$get(); - @NativeSetter("c1") - public abstract void c1$set(byte c1); - @NativeAddressof("c1") - public abstract java.foreign.memory.Pointer c1$ptr(); - @NativeGetter("l") - public abstract long l$get(); - @NativeSetter("l") - public abstract void l$set(long l); - @NativeAddressof("l") - public abstract java.foreign.memory.Pointer l$ptr(); - @NativeGetter("x1") - public abstract byte x1$get(); - @NativeSetter("x1") - public abstract void x1$set(byte x1); - @NativeAddressof("x1") - public abstract java.foreign.memory.Pointer x1$ptr(); - @NativeGetter("y1") - public abstract double y1$get(); - @NativeSetter("y1") - public abstract void y1$set(double y1); - @NativeAddressof("y1") - public abstract java.foreign.memory.Pointer y1$ptr(); - @NativeGetter("p2") - public abstract anon$pad_h$1195 p2$get(); - @NativeSetter("p2") - public abstract void p2$set(anon$pad_h$1195 p2); - @NativeAddressof("p2") - public abstract java.foreign.memory.Pointer p2$ptr(); - @NativeGetter("f1") - public abstract float f1$get(); - @NativeSetter("f1") - public abstract void f1$set(float f1); - @NativeAddressof("f1") - public abstract java.foreign.memory.Pointer f1$ptr(); - } - - @NativeStruct( - "[" + - "f64(x2)" + - "f32(y2)" + - "u8(z2)" + - "x24" + - "](anon$pad_h$1195)") - interface anon$pad_h$1195 extends java.foreign.memory.Struct { - @NativeGetter("x2") - public abstract double x2$get(); - @NativeSetter("x2") - public abstract void x2$set(double x2); - @NativeAddressof("x2") - public abstract java.foreign.memory.Pointer x2$ptr(); - @NativeGetter("y2") - public abstract float y2$get(); - @NativeSetter("y2") - public abstract void y2$set(float y2); - @NativeAddressof("y2") - public abstract java.foreign.memory.Pointer y2$ptr(); - @NativeGetter("z2") - public abstract byte z2$get(); - @NativeSetter("z2") - public abstract void z2$set(byte z2); - @NativeAddressof("z2") - public abstract java.foreign.memory.Pointer z2$ptr(); - } -} --- /dev/null 2019-04-09 23:54:50.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/pad_h.java 2019-04-09 23:54:49.000000000 +0530 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeLocation; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Struct; + +@NativeHeader(path="pad.h") +public interface pad_h { + @NativeStruct( + "[" + + "u8(c1)" + + "x56" + + "[" + + "i64(l)|" + + "[" + + "u8(x1)" + + "x56" + + "f64(y1)" + + "](anon$pad_h$1123)|" + + "${anon$pad_h$1195}(p2)" + + "](anon$pad_h$1086)" + + "f32(f1)" + + "x32" + + "](PaddyStruct)") + interface PaddyStruct extends Struct { + @NativeGetter("c1") + public abstract byte c1$get(); + @NativeSetter("c1") + public abstract void c1$set(byte c1); + @NativeAddressof("c1") + public abstract java.foreign.memory.Pointer c1$ptr(); + @NativeGetter("l") + public abstract long l$get(); + @NativeSetter("l") + public abstract void l$set(long l); + @NativeAddressof("l") + public abstract java.foreign.memory.Pointer l$ptr(); + @NativeGetter("x1") + public abstract byte x1$get(); + @NativeSetter("x1") + public abstract void x1$set(byte x1); + @NativeAddressof("x1") + public abstract java.foreign.memory.Pointer x1$ptr(); + @NativeGetter("y1") + public abstract double y1$get(); + @NativeSetter("y1") + public abstract void y1$set(double y1); + @NativeAddressof("y1") + public abstract java.foreign.memory.Pointer y1$ptr(); + @NativeGetter("p2") + public abstract anon$pad_h$1195 p2$get(); + @NativeSetter("p2") + public abstract void p2$set(anon$pad_h$1195 p2); + @NativeAddressof("p2") + public abstract java.foreign.memory.Pointer p2$ptr(); + @NativeGetter("f1") + public abstract float f1$get(); + @NativeSetter("f1") + public abstract void f1$set(float f1); + @NativeAddressof("f1") + public abstract java.foreign.memory.Pointer f1$ptr(); + } + + @NativeStruct( + "[" + + "f64(x2)" + + "f32(y2)" + + "u8(z2)" + + "x24" + + "](anon$pad_h$1195)") + interface anon$pad_h$1195 extends java.foreign.memory.Struct { + @NativeGetter("x2") + public abstract double x2$get(); + @NativeSetter("x2") + public abstract void x2$set(double x2); + @NativeAddressof("x2") + public abstract java.foreign.memory.Pointer x2$ptr(); + @NativeGetter("y2") + public abstract float y2$get(); + @NativeSetter("y2") + public abstract void y2$set(float y2); + @NativeAddressof("y2") + public abstract java.foreign.memory.Pointer y2$ptr(); + @NativeGetter("z2") + public abstract byte z2$get(); + @NativeSetter("z2") + public abstract void z2$set(byte z2); + @NativeAddressof("z2") + public abstract java.foreign.memory.Pointer z2$ptr(); + } +} --- old/test/jdk/com/sun/tools/jextract/compare/recursive.java 2019-04-09 23:54:52.000000000 +0530 +++ /dev/null 2019-04-09 23:54:52.000000000 +0530 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeLocation; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Pointer; -import java.foreign.memory.Struct; - -/** - * This test is platform dependent, as the C type size may vary on platform. - * Current value is based on x64 with __LP64__. - */ -@NativeHeader(path="recursive.h") -public interface recursive { - - @NativeLocation(file="recursive.h", line=26, column=8) - @NativeStruct("[u64(p):${Bar}](Foo)") - public interface Foo extends Struct { - @NativeLocation(file="recursive.h", line=27, column=17) - @NativeGetter("p") - Pointer p$get(); - @NativeSetter("p") - void p$set(Pointer value); - @NativeAddressof("p") - Pointer> p$ptr(); - } - - @NativeLocation(file = "recursive.h", line=30, column=8) - @NativeStruct("[u64(q):${Foo}](Bar)") - public interface Bar extends Struct { - @NativeLocation(file="recursive.h", line=31, column=17) - @NativeGetter("q") - Pointer q$get(); - @NativeSetter("q") - void q$set(Pointer value); - @NativeAddressof("q") - Pointer> q$ptr(); - } -} --- /dev/null 2019-04-09 23:54:52.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/recursive_h.java 2019-04-09 23:54:51.000000000 +0530 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeLocation; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Pointer; +import java.foreign.memory.Struct; + +/** + * This test is platform dependent, as the C type size may vary on platform. + * Current value is based on x64 with __LP64__. + */ +@NativeHeader(path="recursive.h") +public interface recursive_h { + + @NativeLocation(file="recursive.h", line=26, column=8) + @NativeStruct("[u64(p):${Bar}](Foo)") + public interface Foo extends Struct { + @NativeLocation(file="recursive.h", line=27, column=17) + @NativeGetter("p") + Pointer p$get(); + @NativeSetter("p") + void p$set(Pointer value); + @NativeAddressof("p") + Pointer> p$ptr(); + } + + @NativeLocation(file = "recursive.h", line=30, column=8) + @NativeStruct("[u64(q):${Foo}](Bar)") + public interface Bar extends Struct { + @NativeLocation(file="recursive.h", line=31, column=17) + @NativeGetter("q") + Pointer q$get(); + @NativeSetter("q") + void q$set(Pointer value); + @NativeAddressof("q") + Pointer> q$ptr(); + } +} --- old/test/jdk/com/sun/tools/jextract/compare/simple.java 2019-04-09 23:54:53.000000000 +0530 +++ /dev/null 2019-04-09 23:54:53.000000000 +0530 @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeFunction; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeLocation; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Pointer; -import java.foreign.memory.Struct; - -/** - * This test is platform dependent, as the C type size may vary on platform. - * Current value is based on x64 with __LP64__. - */ -@NativeHeader(path="simple.h", globals = { - "i32(global)", - "${anonymous}(basics)", - "u64(unsigned_int)" } -) -public interface simple { - @NativeLocation(file="simple.h", line=26, column=5) - @NativeGetter("global") - public int global$get(); - @NativeSetter("global") - public void global$set(int arg); - @NativeAddressof("global") - public Pointer global$ptr(); - - @NativeLocation(file="simple.h", line=32, column=8) - @NativeStruct("[" + - "u8(ch)" + - "i8(sch)" + - "i16(s)" + - "i32(n)" + - "i64(l)" + - "i64(ll)" + - "f32(f)" + - "x32" + - "f64(d)" + - "x64" + - "f128(ld)" + - "](anonymous)") - public static interface anonymous extends Struct { - @NativeLocation(file="simple.h", line=33, column=10) - @NativeGetter("ch") - public byte ch$get(); - @NativeSetter("ch") - public void ch$set(byte arg); - @NativeAddressof("ch") - public Pointer ch$ptr(); - - @NativeLocation(file="simple.h", line=34, column=17) - @NativeGetter("sch") - public byte sch$get(); - @NativeSetter("sch") - public void sch$set(byte arg); - @NativeAddressof("sch") - public Pointer sch$ptr(); - - @NativeLocation(file="simple.h", line=35, column=11) - @NativeGetter("s") - public short s$get(); - @NativeSetter("s") - public void s$set(short arg); - @NativeAddressof("s") - public Pointer s$ptr(); - - @NativeLocation(file="simple.h", line=36, column=9) - @NativeGetter("n") - public int n$get(); - @NativeSetter("n") - public void n$set(int arg); - @NativeAddressof("n") - public Pointer n$ptr(); - - @NativeLocation(file="simple.h", line=37, column=10) - @NativeGetter("l") - public long l$get(); - @NativeSetter("l") - public void l$set(long arg); - @NativeAddressof("l") - public Pointer l$ptr(); - - @NativeLocation(file="simple.h", line=38, column=15) - @NativeGetter("ll") - public long ll$get(); - @NativeSetter("ll") - public void ll$set(long arg); - @NativeAddressof("ll") - public Pointer ll$ptr(); - - @NativeLocation(file="simple.h", line=39, column=11) - @NativeGetter("f") - public float f$get(); - @NativeSetter("f") - public void f$set(float arg); - @NativeAddressof("f") - public Pointer f$ptr(); - - @NativeLocation(file="simple.h", line=40, column=12) - @NativeGetter("d") - public double d$get(); - @NativeSetter("d") - public void d$set(double arg); - @NativeAddressof("d") - public Pointer d$ptr(); - - @NativeLocation(file="simple.h", line=41, column=17) - @NativeGetter("ld") - public double ld$get(); - @NativeSetter("ld") - public void ld$set(double arg); - @NativeAddressof("ld") - public Pointer ld$ptr(); - } - - @NativeLocation(file="simple.h", line=42, column=3) - @NativeGetter("basics") - public anonymous basics$get(); - @NativeSetter("basics") - public void basics$set(anonymous arg); - @NativeAddressof("basics") - public Pointer basics$ptr(); - - @NativeLocation(file = "simple.h", line = 45, column = 8) - @NativeStruct("[" + - "u8(b)" + - "u8(ch)" + - "u16(s)" + - "u32(n)" + - "u64(l)" + - "u64(ll)" + - "](_unsigned)") - public static interface _unsigned extends Struct<_unsigned> { - @NativeLocation(file="simple.h", line=46, column=11) - @NativeGetter("b") - public boolean b$get(); - @NativeSetter("b") - public void b$set(boolean arg); - @NativeAddressof("b") - public Pointer b$ptr(); - - @NativeLocation(file="simple.h", line=47, column=19) - @NativeGetter("ch") - public byte ch$get(); - @NativeSetter("ch") - public void ch$set(byte c); - @NativeAddressof("ch") - public Pointer ch$ptr(); - - @NativeLocation(file="simple.h", line=48, column=20) - @NativeGetter("s") - public short s$get(); - @NativeSetter("s") - public void s$set(short s); - @NativeAddressof("s") - public Pointer s$ptr(); - - @NativeLocation(file="simple.h", line=49, column=18) - @NativeGetter("n") - public int n$get(); - @NativeSetter("n") - public void n$set(int i); - @NativeAddressof("n") - public Pointer n$ptr(); - - @NativeLocation(file="simple.h", line=50, column=19) - @NativeGetter("l") - public long l$get(); - @NativeSetter("l") - public void l$set(long l); - @NativeAddressof("l") - public Pointer l$ptr(); - - @NativeLocation(file="simple.h", line=51, column=24) - @NativeGetter("ll") - public long ll$get(); - @NativeSetter("ll") - public void ll$set(long l); - @NativeAddressof("ll") - public Pointer ll$ptr(); - } - - @NativeLocation(file="simple.h", line=52, column=4) - @NativeGetter("unsigned_int") - public Pointer<_unsigned> unsigned_int$get(); - @NativeSetter("unsigned_int") - public void unsigned_int$set(Pointer<_unsigned> arg); - @NativeAddressof("unsigned_int") - public Pointer> unsigned_int$ptr(); - - @NativeLocation(file = "simple.h", line = 54, column = 6) - @NativeFunction("(${anonymous}u64:u8)v") - public void func(anonymous s, Pointer str); -} --- /dev/null 2019-04-09 23:54:53.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/simple_h.java 2019-04-09 23:54:52.000000000 +0530 @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeFunction; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeLocation; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Pointer; +import java.foreign.memory.Struct; + +/** + * This test is platform dependent, as the C type size may vary on platform. + * Current value is based on x64 with __LP64__. + */ +@NativeHeader(path="simple.h", globals = { + "i32(global)", + "${anonymous}(basics)", + "u64(unsigned_int)" } +) +public interface simple_h { + @NativeLocation(file="simple.h", line=26, column=5) + @NativeGetter("global") + public int global$get(); + @NativeSetter("global") + public void global$set(int arg); + @NativeAddressof("global") + public Pointer global$ptr(); + + @NativeLocation(file="simple.h", line=32, column=8) + @NativeStruct("[" + + "u8(ch)" + + "i8(sch)" + + "i16(s)" + + "i32(n)" + + "i64(l)" + + "i64(ll)" + + "f32(f)" + + "x32" + + "f64(d)" + + "x64" + + "f128(ld)" + + "](anonymous)") + public static interface anonymous extends Struct { + @NativeLocation(file="simple.h", line=33, column=10) + @NativeGetter("ch") + public byte ch$get(); + @NativeSetter("ch") + public void ch$set(byte arg); + @NativeAddressof("ch") + public Pointer ch$ptr(); + + @NativeLocation(file="simple.h", line=34, column=17) + @NativeGetter("sch") + public byte sch$get(); + @NativeSetter("sch") + public void sch$set(byte arg); + @NativeAddressof("sch") + public Pointer sch$ptr(); + + @NativeLocation(file="simple.h", line=35, column=11) + @NativeGetter("s") + public short s$get(); + @NativeSetter("s") + public void s$set(short arg); + @NativeAddressof("s") + public Pointer s$ptr(); + + @NativeLocation(file="simple.h", line=36, column=9) + @NativeGetter("n") + public int n$get(); + @NativeSetter("n") + public void n$set(int arg); + @NativeAddressof("n") + public Pointer n$ptr(); + + @NativeLocation(file="simple.h", line=37, column=10) + @NativeGetter("l") + public long l$get(); + @NativeSetter("l") + public void l$set(long arg); + @NativeAddressof("l") + public Pointer l$ptr(); + + @NativeLocation(file="simple.h", line=38, column=15) + @NativeGetter("ll") + public long ll$get(); + @NativeSetter("ll") + public void ll$set(long arg); + @NativeAddressof("ll") + public Pointer ll$ptr(); + + @NativeLocation(file="simple.h", line=39, column=11) + @NativeGetter("f") + public float f$get(); + @NativeSetter("f") + public void f$set(float arg); + @NativeAddressof("f") + public Pointer f$ptr(); + + @NativeLocation(file="simple.h", line=40, column=12) + @NativeGetter("d") + public double d$get(); + @NativeSetter("d") + public void d$set(double arg); + @NativeAddressof("d") + public Pointer d$ptr(); + + @NativeLocation(file="simple.h", line=41, column=17) + @NativeGetter("ld") + public double ld$get(); + @NativeSetter("ld") + public void ld$set(double arg); + @NativeAddressof("ld") + public Pointer ld$ptr(); + } + + @NativeLocation(file="simple.h", line=42, column=3) + @NativeGetter("basics") + public anonymous basics$get(); + @NativeSetter("basics") + public void basics$set(anonymous arg); + @NativeAddressof("basics") + public Pointer basics$ptr(); + + @NativeLocation(file = "simple.h", line = 45, column = 8) + @NativeStruct("[" + + "u8(b)" + + "u8(ch)" + + "u16(s)" + + "u32(n)" + + "u64(l)" + + "u64(ll)" + + "](_unsigned)") + public static interface _unsigned extends Struct<_unsigned> { + @NativeLocation(file="simple.h", line=46, column=11) + @NativeGetter("b") + public boolean b$get(); + @NativeSetter("b") + public void b$set(boolean arg); + @NativeAddressof("b") + public Pointer b$ptr(); + + @NativeLocation(file="simple.h", line=47, column=19) + @NativeGetter("ch") + public byte ch$get(); + @NativeSetter("ch") + public void ch$set(byte c); + @NativeAddressof("ch") + public Pointer ch$ptr(); + + @NativeLocation(file="simple.h", line=48, column=20) + @NativeGetter("s") + public short s$get(); + @NativeSetter("s") + public void s$set(short s); + @NativeAddressof("s") + public Pointer s$ptr(); + + @NativeLocation(file="simple.h", line=49, column=18) + @NativeGetter("n") + public int n$get(); + @NativeSetter("n") + public void n$set(int i); + @NativeAddressof("n") + public Pointer n$ptr(); + + @NativeLocation(file="simple.h", line=50, column=19) + @NativeGetter("l") + public long l$get(); + @NativeSetter("l") + public void l$set(long l); + @NativeAddressof("l") + public Pointer l$ptr(); + + @NativeLocation(file="simple.h", line=51, column=24) + @NativeGetter("ll") + public long ll$get(); + @NativeSetter("ll") + public void ll$set(long l); + @NativeAddressof("ll") + public Pointer ll$ptr(); + } + + @NativeLocation(file="simple.h", line=52, column=4) + @NativeGetter("unsigned_int") + public Pointer<_unsigned> unsigned_int$get(); + @NativeSetter("unsigned_int") + public void unsigned_int$set(Pointer<_unsigned> arg); + @NativeAddressof("unsigned_int") + public Pointer> unsigned_int$ptr(); + + @NativeLocation(file = "simple.h", line = 54, column = 6) + @NativeFunction("(${anonymous}u64:u8)v") + public void func(anonymous s, Pointer str); +} --- old/test/jdk/com/sun/tools/jextract/compare/windows/bitfields.java 2019-04-09 23:54:54.000000000 +0530 +++ /dev/null 2019-04-09 23:54:55.000000000 +0530 @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Pointer; -import java.foreign.memory.Struct; - -@NativeHeader(path="bitfields.h") -public interface bitfields { // platform dependent - - /* - class bitfields1 size(24): - +--- - 0. | x (bitstart=0,nbits=2) - 8. | y (bitstart=0,nbits=15) - 16. | z (bitstart=0,nbits=20) - 20. | w (bitstart=0,nbits=13) - +--- - */ - - - @NativeStruct("[" + - "u64=[" + - "i2(x)" + - "x62]" + - "u64=[" + - "i15(y)" + - "x49]" + - "u64=[" + - "i20(z)" + - "x12" + - "i13(w)" + - "x19]" + - "](bitfields1)") - interface bitfields1 extends Struct { - @NativeGetter("x") - long x$get(); - @NativeSetter("x") - void x$set(long value); - @NativeGetter("y") - long y$get(); - @NativeSetter("y") - void y$set(long value); - @NativeGetter("z") - int z$get(); - @NativeSetter("z") - void z$set(int value); - @NativeGetter("w") - int w$get(); - @NativeSetter("w") - void w$set(int value); - } - - /* - class bitfields2 size(16): - +--- - 0. | c (bitstart=0,nbits=3) - 0. | c2 (bitstart=3,nbits=3) - 1. | c3 (bitstart=0,nbits=7) - | (size=2) - 4. | i (bitstart=0,nbits=4) - 8. | l (bitstart=0,nbits=21) - 8. | ll (bitstart=21,nbits=42) - +--- - */ - - @NativeStruct("[" + - "u64=[" + - "u3(c)" + - "u3(c2)" + - "x2" + - "u7(c3)" + - "x17" + // includes 2 byte alignment member - "i4(i)" + - "x28]" + - "u64=[" + - "i21(l)" + - "i42(ll)" + - "x1]" + - "](bitfields2)") - interface bitfields2 extends Struct { // platform dependent - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - @NativeGetter("c2") - byte c2$get(); - @NativeSetter("c2") - void c2$set(byte value); - @NativeGetter("c3") - byte c3$get(); - @NativeSetter("c3") - void c3$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - @NativeGetter("ll") - long ll$get(); - @NativeSetter("ll") - void ll$set(long value); - } - - /* - class bitfields3 size(20): - +--- - 0. | c1 (bitstart=0,nbits=4) - | (size=3) - 4. | i (bitstart=0,nbits=20) - 8. | c2 (bitstart=0,nbits=8) - | (size=3) - 12. | l1 (bitstart=0,nbits=32) - 16. | l2 (bitstart=0,nbits=32) - +--- - */ - - @NativeStruct("[" + - "u32=[" + - "u4(c1)" + - "x28]" + // includes 3 byte alignment member - "u32=[" + - "i20(i)" + - "x12]" + - "u32=[" + - "u8(c2)" + - "x24]" + // 3 byte alignment member - "u32=[" + - "i32(l1)]" + - "u32=[" + - "i32(l2)]" + - "](bitfields3)") - interface bitfields3 extends Struct { // platform dependent - @NativeGetter("c1") - byte c1$get(); - @NativeSetter("c1") - void c1$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeGetter("c2") - byte c2$get(); - @NativeSetter("c2") - void c2$set(byte value); - @NativeGetter("l1") - int l1$get(); - @NativeSetter("l1") - void l1$set(int value); - @NativeGetter("l2") - int l2$get(); - @NativeSetter("l2") - void l2$set(int value); - } - - @NativeStruct("[" + - "i64(l)" + - "u64=[" + - "u4(c)" + - "x60]" + - "](bitfields4)") - interface bitfields4 extends Struct { - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - @NativeAddressof("l") - Pointer l$ptr(); - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - } - - @NativeStruct("[" + - "u64=[" + - "u7(c)" + - "x57]" + - "u64=[" + - "i63(l)" + - "x1]" + - "](bitfields5)") - interface bitfields5 extends Struct { - @NativeGetter("c") - byte c$get(); - @NativeSetter("c") - void c$set(byte value); - @NativeGetter("l") - long l$get(); - @NativeSetter("l") - void l$set(long value); - } - - @NativeStruct("[" + - "u8=[" + - "u4(c1)]|" + - "i32=[" + - "i20(i)]" + - "](bitfields6)") - interface bitfields6 extends Struct { - @NativeGetter("c1") - byte c1$get(); - @NativeSetter("c1") - void c1$set(byte value); - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - } - - @NativeStruct("[" + - "u32(x)" + - "u32=[u15(a)u17(pad)]" + - "](bitfields7)") - public interface bitfields7 extends Struct { - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int value); - @NativeAddressof("x") - Pointer x$ptr(); - @NativeGetter("a") - int a$get(); - @NativeSetter("a") - void a$set(int value); - @NativeGetter("pad") - int pad$get(); - @NativeSetter("pad") - void pad$set(int value); - } - - @NativeStruct("[" + - "i32(i)" + - "i32(j)" + - "](Point)") - public interface Point extends Struct { - @NativeGetter("i") - int i$get(); - @NativeSetter("i") - void i$set(int value); - @NativeAddressof("i") - Pointer i$ptr(); - @NativeGetter("j") - int j$get(); - @NativeSetter("j") - void j$set(int value); - @NativeAddressof("j") - Pointer j$ptr(); - } - - @NativeStruct("[" + - "${Point}(p)" + - "u32=[i12(x)i2(y)x18]" + - "](bitfields8)") - public interface bitfields8 extends Struct { - @NativeGetter("p") - Point p$get(); - @NativeSetter("p") - void p$set(Point value); - Pointer p$ptr(); - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int value); - @NativeGetter("y") - int y$get(); - @NativeSetter("y") - void y$set(int value); - } - - @NativeStruct("[" + - "u32=[u1(x)x7u8(y)x16]" + - "i32(z)" + - "](bitfields9)") - public interface bitfields9 extends Struct { - @NativeGetter("x") - int x$get(); - @NativeSetter("x") - void x$set(int var1); - - @NativeGetter("y") - int y$get(); - @NativeSetter("y") - void y$set(int var1); - - @NativeGetter("z") - int z$get(); - @NativeSetter("z") - void z$set(int var1); - @NativeAddressof("z") - Pointer z$ptr(); - } - - @NativeStruct("[u32=[u1(x)]|x64](bitfields10)") - public interface bitfields10 extends Struct { - @NativeGetter("x") - int x$get(); - - @NativeSetter("x") - void x$set(int var1); - } - -} --- /dev/null 2019-04-09 23:54:55.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/windows/bitfields_h.java 2019-04-09 23:54:54.000000000 +0530 @@ -0,0 +1,334 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Pointer; +import java.foreign.memory.Struct; + +@NativeHeader(path="bitfields.h") +public interface bitfields_h { // platform dependent + + /* + class bitfields1 size(24): + +--- + 0. | x (bitstart=0,nbits=2) + 8. | y (bitstart=0,nbits=15) + 16. | z (bitstart=0,nbits=20) + 20. | w (bitstart=0,nbits=13) + +--- + */ + + + @NativeStruct("[" + + "u64=[" + + "i2(x)" + + "x62]" + + "u64=[" + + "i15(y)" + + "x49]" + + "u64=[" + + "i20(z)" + + "x12" + + "i13(w)" + + "x19]" + + "](bitfields1)") + interface bitfields1 extends Struct { + @NativeGetter("x") + long x$get(); + @NativeSetter("x") + void x$set(long value); + @NativeGetter("y") + long y$get(); + @NativeSetter("y") + void y$set(long value); + @NativeGetter("z") + int z$get(); + @NativeSetter("z") + void z$set(int value); + @NativeGetter("w") + int w$get(); + @NativeSetter("w") + void w$set(int value); + } + + /* + class bitfields2 size(16): + +--- + 0. | c (bitstart=0,nbits=3) + 0. | c2 (bitstart=3,nbits=3) + 1. | c3 (bitstart=0,nbits=7) + | (size=2) + 4. | i (bitstart=0,nbits=4) + 8. | l (bitstart=0,nbits=21) + 8. | ll (bitstart=21,nbits=42) + +--- + */ + + @NativeStruct("[" + + "u64=[" + + "u3(c)" + + "u3(c2)" + + "x2" + + "u7(c3)" + + "x17" + // includes 2 byte alignment member + "i4(i)" + + "x28]" + + "u64=[" + + "i21(l)" + + "i42(ll)" + + "x1]" + + "](bitfields2)") + interface bitfields2 extends Struct { // platform dependent + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + @NativeGetter("c2") + byte c2$get(); + @NativeSetter("c2") + void c2$set(byte value); + @NativeGetter("c3") + byte c3$get(); + @NativeSetter("c3") + void c3$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + @NativeGetter("ll") + long ll$get(); + @NativeSetter("ll") + void ll$set(long value); + } + + /* + class bitfields3 size(20): + +--- + 0. | c1 (bitstart=0,nbits=4) + | (size=3) + 4. | i (bitstart=0,nbits=20) + 8. | c2 (bitstart=0,nbits=8) + | (size=3) + 12. | l1 (bitstart=0,nbits=32) + 16. | l2 (bitstart=0,nbits=32) + +--- + */ + + @NativeStruct("[" + + "u32=[" + + "u4(c1)" + + "x28]" + // includes 3 byte alignment member + "u32=[" + + "i20(i)" + + "x12]" + + "u32=[" + + "u8(c2)" + + "x24]" + // 3 byte alignment member + "u32=[" + + "i32(l1)]" + + "u32=[" + + "i32(l2)]" + + "](bitfields3)") + interface bitfields3 extends Struct { // platform dependent + @NativeGetter("c1") + byte c1$get(); + @NativeSetter("c1") + void c1$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeGetter("c2") + byte c2$get(); + @NativeSetter("c2") + void c2$set(byte value); + @NativeGetter("l1") + int l1$get(); + @NativeSetter("l1") + void l1$set(int value); + @NativeGetter("l2") + int l2$get(); + @NativeSetter("l2") + void l2$set(int value); + } + + @NativeStruct("[" + + "i64(l)" + + "u64=[" + + "u4(c)" + + "x60]" + + "](bitfields4)") + interface bitfields4 extends Struct { + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + @NativeAddressof("l") + Pointer l$ptr(); + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + } + + @NativeStruct("[" + + "u64=[" + + "u7(c)" + + "x57]" + + "u64=[" + + "i63(l)" + + "x1]" + + "](bitfields5)") + interface bitfields5 extends Struct { + @NativeGetter("c") + byte c$get(); + @NativeSetter("c") + void c$set(byte value); + @NativeGetter("l") + long l$get(); + @NativeSetter("l") + void l$set(long value); + } + + @NativeStruct("[" + + "u8=[" + + "u4(c1)]|" + + "i32=[" + + "i20(i)]" + + "](bitfields6)") + interface bitfields6 extends Struct { + @NativeGetter("c1") + byte c1$get(); + @NativeSetter("c1") + void c1$set(byte value); + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + } + + @NativeStruct("[" + + "u32(x)" + + "u32=[u15(a)u17(pad)]" + + "](bitfields7)") + public interface bitfields7 extends Struct { + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int value); + @NativeAddressof("x") + Pointer x$ptr(); + @NativeGetter("a") + int a$get(); + @NativeSetter("a") + void a$set(int value); + @NativeGetter("pad") + int pad$get(); + @NativeSetter("pad") + void pad$set(int value); + } + + @NativeStruct("[" + + "i32(i)" + + "i32(j)" + + "](Point)") + public interface Point extends Struct { + @NativeGetter("i") + int i$get(); + @NativeSetter("i") + void i$set(int value); + @NativeAddressof("i") + Pointer i$ptr(); + @NativeGetter("j") + int j$get(); + @NativeSetter("j") + void j$set(int value); + @NativeAddressof("j") + Pointer j$ptr(); + } + + @NativeStruct("[" + + "${Point}(p)" + + "u32=[i12(x)i2(y)x18]" + + "](bitfields8)") + public interface bitfields8 extends Struct { + @NativeGetter("p") + Point p$get(); + @NativeSetter("p") + void p$set(Point value); + Pointer p$ptr(); + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int value); + @NativeGetter("y") + int y$get(); + @NativeSetter("y") + void y$set(int value); + } + + @NativeStruct("[" + + "u32=[u1(x)x7u8(y)x16]" + + "i32(z)" + + "](bitfields9)") + public interface bitfields9 extends Struct { + @NativeGetter("x") + int x$get(); + @NativeSetter("x") + void x$set(int var1); + + @NativeGetter("y") + int y$get(); + @NativeSetter("y") + void y$set(int var1); + + @NativeGetter("z") + int z$get(); + @NativeSetter("z") + void z$set(int var1); + @NativeAddressof("z") + Pointer z$ptr(); + } + + @NativeStruct("[u32=[u1(x)]|x64](bitfields10)") + public interface bitfields10 extends Struct { + @NativeGetter("x") + int x$get(); + + @NativeSetter("x") + void x$set(int var1); + } + +} --- old/test/jdk/com/sun/tools/jextract/compare/windows/simple.java 2019-04-09 23:54:56.000000000 +0530 +++ /dev/null 2019-04-09 23:54:56.000000000 +0530 @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.acme; - -import java.foreign.annotations.NativeAddressof; -import java.foreign.annotations.NativeFunction; -import java.foreign.annotations.NativeGetter; -import java.foreign.annotations.NativeHeader; -import java.foreign.annotations.NativeLocation; -import java.foreign.annotations.NativeSetter; -import java.foreign.annotations.NativeStruct; -import java.foreign.memory.Pointer; -import java.foreign.memory.Struct; - -/** - * This test is platform dependent, as the C type size may vary on platform. - * Current value is based on x64 with __LP64__. - */ -@NativeHeader(path="simple.h", globals = - {"i32(global)", "${anonymous}(basics)", "u64(unsigned_int):${_unsigned}"} -) -public interface simple { - @NativeLocation(file="simple.h", line=26, column=5) - @NativeGetter("global") - public int global$get(); - @NativeSetter("global") - public void global$set(int arg); - @NativeAddressof("global") - public Pointer global$ptr(); - - @NativeLocation(file="simple.h", line=32, column=8) - @NativeStruct("[" + - "u8(ch)" + - "i8(sch)" + - "i16(s)" + - "i32(n)" + - "i32(l)" + // platform dependent - "x32" + - "i64(ll)" + - "f32(f)" + - "x32" + - "f64(d)" + - "f64(ld)" + // platform dependent - "](anonymous)") - public static interface anonymous extends Struct { - @NativeLocation(file="simple.h", line=33, column=10) - @NativeGetter("ch") - public byte ch$get(); - @NativeSetter("ch") - public void ch$set(byte arg); - @NativeAddressof("ch") - public Pointer ch$ptr(); - - @NativeLocation(file="simple.h", line=34, column=17) - @NativeGetter("sch") - public byte sch$get(); - @NativeSetter("sch") - public void sch$set(byte arg); - @NativeAddressof("sch") - public Pointer sch$ptr(); - - @NativeLocation(file="simple.h", line=35, column=11) - @NativeGetter("s") - public short s$get(); - @NativeSetter("s") - public void s$set(short arg); - @NativeAddressof("s") - public Pointer s$ptr(); - - @NativeLocation(file="simple.h", line=36, column=9) - @NativeGetter("n") - public int n$get(); - @NativeSetter("n") - public void n$set(int arg); - @NativeAddressof("n") - public Pointer n$ptr(); - - @NativeLocation(file="simple.h", line=37, column=10) - @NativeGetter("l") - public int l$get(); - @NativeSetter("l") - public void l$set(int arg); - @NativeAddressof("l") - public Pointer l$ptr(); - - @NativeLocation(file="simple.h", line=38, column=15) - @NativeGetter("ll") - public long ll$get(); - @NativeSetter("ll") - public void ll$set(long arg); - @NativeAddressof("ll") - public Pointer ll$ptr(); - - @NativeLocation(file="simple.h", line=39, column=11) - @NativeGetter("f") - public float f$get(); - @NativeSetter("f") - public void f$set(float arg); - @NativeAddressof("f") - public Pointer f$ptr(); - - @NativeLocation(file="simple.h", line=40, column=12) - @NativeGetter("d") - public double d$get(); - @NativeSetter("d") - public void d$set(double arg); - @NativeAddressof("d") - public Pointer d$ptr(); - - @NativeLocation(file="simple.h", line=41, column=17) - @NativeGetter("ld") - public double ld$get(); - @NativeSetter("ld") - public void ld$set(double arg); - @NativeAddressof("ld") - public Pointer ld$ptr(); - } - - @NativeLocation(file="simple.h", line=42, column=3) - @NativeGetter("basics") - public anonymous basics$get(); - @NativeSetter("basics") - public void basics$set(anonymous arg); - @NativeAddressof("basics") - public Pointer basics$ptr(); - - @NativeLocation(file = "simple.h", line = 45, column = 8) - @NativeStruct("[" + - "u8(b)" + - "u8(ch)" + - "u16(s)" + - "u32(n)" + - "u32(l)" + // platform dependent - "x32" + - "u64(ll)" + - "](_unsigned)") - public static interface _unsigned extends Struct<_unsigned> { - @NativeLocation(file="simple.h", line=46, column=11) - @NativeGetter("b") - public boolean b$get(); - @NativeSetter("b") - public void b$set(boolean arg); - @NativeAddressof("b") - public Pointer b$ptr(); - - @NativeLocation(file="simple.h", line=47, column=19) - @NativeGetter("ch") - public byte ch$get(); - @NativeSetter("ch") - public void ch$set(byte c); - @NativeAddressof("ch") - public Pointer ch$ptr(); - - @NativeLocation(file="simple.h", line=48, column=20) - @NativeGetter("s") - public short s$get(); - @NativeSetter("s") - public void s$set(short s); - @NativeAddressof("s") - public Pointer s$ptr(); - - @NativeLocation(file="simple.h", line=49, column=18) - @NativeGetter("n") - public int n$get(); - @NativeSetter("n") - public void n$set(int i); - @NativeAddressof("n") - public Pointer n$ptr(); - - @NativeLocation(file="simple.h", line=50, column=19) - @NativeGetter("l") - public int l$get(); - @NativeSetter("l") - public void l$set(int l); - @NativeAddressof("l") - public Pointer l$ptr(); - - @NativeLocation(file="simple.h", line=51, column=24) - @NativeGetter("ll") - public long ll$get(); - @NativeSetter("ll") - public void ll$set(long l); - @NativeAddressof("ll") - public Pointer ll$ptr(); - } - - @NativeLocation(file="simple.h", line=52, column=4) - @NativeGetter("unsigned_int") - public Pointer<_unsigned> unsigned_int$get(); - @NativeSetter("unsigned_int") - public void unsigned_int$set(Pointer<_unsigned> arg); - @NativeAddressof("unsigned_int") - public Pointer> unsigned_int$ptr(); - - @NativeLocation(file = "simple.h", line = 54, column = 6) - @NativeFunction("(${anonymous}u64:u8)v") - public void func(anonymous s, Pointer str); -} --- /dev/null 2019-04-09 23:54:56.000000000 +0530 +++ new/test/jdk/com/sun/tools/jextract/compare/windows/simple_h.java 2019-04-09 23:54:55.000000000 +0530 @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.acme; + +import java.foreign.annotations.NativeAddressof; +import java.foreign.annotations.NativeFunction; +import java.foreign.annotations.NativeGetter; +import java.foreign.annotations.NativeHeader; +import java.foreign.annotations.NativeLocation; +import java.foreign.annotations.NativeSetter; +import java.foreign.annotations.NativeStruct; +import java.foreign.memory.Pointer; +import java.foreign.memory.Struct; + +/** + * This test is platform dependent, as the C type size may vary on platform. + * Current value is based on x64 with __LP64__. + */ +@NativeHeader(path="simple.h", globals = + {"i32(global)", "${anonymous}(basics)", "u64(unsigned_int):${_unsigned}"} +) +public interface simple_h { + @NativeLocation(file="simple.h", line=26, column=5) + @NativeGetter("global") + public int global$get(); + @NativeSetter("global") + public void global$set(int arg); + @NativeAddressof("global") + public Pointer global$ptr(); + + @NativeLocation(file="simple.h", line=32, column=8) + @NativeStruct("[" + + "u8(ch)" + + "i8(sch)" + + "i16(s)" + + "i32(n)" + + "i32(l)" + // platform dependent + "x32" + + "i64(ll)" + + "f32(f)" + + "x32" + + "f64(d)" + + "f64(ld)" + // platform dependent + "](anonymous)") + public static interface anonymous extends Struct { + @NativeLocation(file="simple.h", line=33, column=10) + @NativeGetter("ch") + public byte ch$get(); + @NativeSetter("ch") + public void ch$set(byte arg); + @NativeAddressof("ch") + public Pointer ch$ptr(); + + @NativeLocation(file="simple.h", line=34, column=17) + @NativeGetter("sch") + public byte sch$get(); + @NativeSetter("sch") + public void sch$set(byte arg); + @NativeAddressof("sch") + public Pointer sch$ptr(); + + @NativeLocation(file="simple.h", line=35, column=11) + @NativeGetter("s") + public short s$get(); + @NativeSetter("s") + public void s$set(short arg); + @NativeAddressof("s") + public Pointer s$ptr(); + + @NativeLocation(file="simple.h", line=36, column=9) + @NativeGetter("n") + public int n$get(); + @NativeSetter("n") + public void n$set(int arg); + @NativeAddressof("n") + public Pointer n$ptr(); + + @NativeLocation(file="simple.h", line=37, column=10) + @NativeGetter("l") + public int l$get(); + @NativeSetter("l") + public void l$set(int arg); + @NativeAddressof("l") + public Pointer l$ptr(); + + @NativeLocation(file="simple.h", line=38, column=15) + @NativeGetter("ll") + public long ll$get(); + @NativeSetter("ll") + public void ll$set(long arg); + @NativeAddressof("ll") + public Pointer ll$ptr(); + + @NativeLocation(file="simple.h", line=39, column=11) + @NativeGetter("f") + public float f$get(); + @NativeSetter("f") + public void f$set(float arg); + @NativeAddressof("f") + public Pointer f$ptr(); + + @NativeLocation(file="simple.h", line=40, column=12) + @NativeGetter("d") + public double d$get(); + @NativeSetter("d") + public void d$set(double arg); + @NativeAddressof("d") + public Pointer d$ptr(); + + @NativeLocation(file="simple.h", line=41, column=17) + @NativeGetter("ld") + public double ld$get(); + @NativeSetter("ld") + public void ld$set(double arg); + @NativeAddressof("ld") + public Pointer ld$ptr(); + } + + @NativeLocation(file="simple.h", line=42, column=3) + @NativeGetter("basics") + public anonymous basics$get(); + @NativeSetter("basics") + public void basics$set(anonymous arg); + @NativeAddressof("basics") + public Pointer basics$ptr(); + + @NativeLocation(file = "simple.h", line = 45, column = 8) + @NativeStruct("[" + + "u8(b)" + + "u8(ch)" + + "u16(s)" + + "u32(n)" + + "u32(l)" + // platform dependent + "x32" + + "u64(ll)" + + "](_unsigned)") + public static interface _unsigned extends Struct<_unsigned> { + @NativeLocation(file="simple.h", line=46, column=11) + @NativeGetter("b") + public boolean b$get(); + @NativeSetter("b") + public void b$set(boolean arg); + @NativeAddressof("b") + public Pointer b$ptr(); + + @NativeLocation(file="simple.h", line=47, column=19) + @NativeGetter("ch") + public byte ch$get(); + @NativeSetter("ch") + public void ch$set(byte c); + @NativeAddressof("ch") + public Pointer ch$ptr(); + + @NativeLocation(file="simple.h", line=48, column=20) + @NativeGetter("s") + public short s$get(); + @NativeSetter("s") + public void s$set(short s); + @NativeAddressof("s") + public Pointer s$ptr(); + + @NativeLocation(file="simple.h", line=49, column=18) + @NativeGetter("n") + public int n$get(); + @NativeSetter("n") + public void n$set(int i); + @NativeAddressof("n") + public Pointer n$ptr(); + + @NativeLocation(file="simple.h", line=50, column=19) + @NativeGetter("l") + public int l$get(); + @NativeSetter("l") + public void l$set(int l); + @NativeAddressof("l") + public Pointer l$ptr(); + + @NativeLocation(file="simple.h", line=51, column=24) + @NativeGetter("ll") + public long ll$get(); + @NativeSetter("ll") + public void ll$set(long l); + @NativeAddressof("ll") + public Pointer ll$ptr(); + } + + @NativeLocation(file="simple.h", line=52, column=4) + @NativeGetter("unsigned_int") + public Pointer<_unsigned> unsigned_int$get(); + @NativeSetter("unsigned_int") + public void unsigned_int$set(Pointer<_unsigned> arg); + @NativeAddressof("unsigned_int") + public Pointer> unsigned_int$ptr(); + + @NativeLocation(file = "simple.h", line = 54, column = 6) + @NativeFunction("(${anonymous}u64:u8)v") + public void func(anonymous s, Pointer str); +}