< prev index next >
src/jdk.jextract/share/classes/com/sun/tools/jextract/AsmCodeFactory.java
Print this page
rev 47744 : jextract tool
rev 49470 : [mq]: 8200452
@@ -109,11 +109,13 @@
private void writeClassFile(final ClassWriter cw, String clsName)
throws IOException {
cw.visitEnd();
byte[] bytecodes = cw.toByteArray();
- types.put(clsName, bytecodes);
+ if (null != types.put(clsName, bytecodes)) {
+ logger.warning("Class " + clsName + " definition is overwritten");
+ }
}
/**
*
* @param cw ClassWriter for the struct
@@ -232,10 +234,19 @@
handleException(ex);
}
}
private void createEnum(Cursor cursor) {
+ // Anonymous enum without proper name, define in global_cw
+ if (cursor.isAnonymousEnum()) {
+ logger.fine("create anonymous enum");
+ cursor.stream()
+ .filter(cx -> cx.kind() == CursorKind.EnumConstantDecl)
+ .forEachOrdered(cx -> addConstant(global_cw, cx));
+ return;
+ }
+
String nativeName = Utils.getIdentifier(cursor);
logger.fine(() -> "create enum: " + nativeName);
String intf = Utils.toClassName(nativeName);
String name = internal_name + "$" + intf;
< prev index next >