< prev index next >
test/jdk/com/sun/tools/jextract/JextractToolProviderTest.java
Print this page
*** 427,432 ****
--- 427,469 ----
assertNull(findMethod(cls, "junk", Object[].class));
} finally {
deleteFile(helloJar);
}
}
+
+ @Test
+ public void testNestedStructsUnions() {
+ Path nestedJar = getOutputFilePath("nested.jar");
+ deleteFile(nestedJar);
+ Path nestedH = getInputFilePath("nested.h");
+ try {
+ checkSuccess(null, "-o", nestedJar.toString(), nestedH.toString());
+ assertNotNull(loadClass("nested", nestedJar));
+ Class<?> fooCls = loadClass("nested$Foo", nestedJar);
+ assertNotNull(fooCls);
+ // struct Foo has no getters for "x", "y" etc.
+ assertNull(findMethod(fooCls, "x$get"));
+ assertNull(findMethod(fooCls, "y$get"));
+ // struct Foo has getters for bar and color
+ assertNotNull(findMethod(fooCls, "bar$get"));
+ assertNotNull(findMethod(fooCls, "color$get"));
+ // make sure nested types are handled without nested namespace!
+ assertNotNull(loadClass("nested$Bar", nestedJar));
+ assertNotNull(loadClass("nested$Color", nestedJar));
+
+ Class<?> uCls = loadClass("nested$U", nestedJar);
+ assertNotNull(uCls);
+ // union U has no getters for "x", "y" etc.
+ assertNull(findMethod(uCls, "x$get"));
+ assertNull(findMethod(uCls, "y$get"));
+ // union U has getters for point, rgb, i
+ assertNotNull(findMethod(uCls, "point$get"));
+ assertNotNull(findMethod(uCls, "rgb$get"));
+ assertNotNull(findMethod(uCls, "i$get"));
+ // make sure nested types are handled without nested namespace!
+ assertNotNull(loadClass("nested$Point", nestedJar));
+ assertNotNull(loadClass("nested$RGB", nestedJar));
+ } finally {
+ deleteFile(nestedJar);
+ }
+ }
}
< prev index next >