< 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,119 ****
private void writeClassFile(final ClassWriter cw, String clsName)
throws IOException {
cw.visitEnd();
byte[] bytecodes = cw.toByteArray();
! types.put(clsName, bytecodes);
}
/**
*
* @param cw ClassWriter for the struct
--- 109,121 ----
private void writeClassFile(final ClassWriter cw, String clsName)
throws IOException {
cw.visitEnd();
byte[] bytecodes = cw.toByteArray();
! if (null != types.put(clsName, bytecodes)) {
! logger.warning("Class " + clsName + " definition is overwritten");
! }
}
/**
*
* @param cw ClassWriter for the struct
*** 232,241 ****
--- 234,252 ----
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 >