--- old/src/jdk.jextract/share/classes/com/sun/tools/jextract/AsmCodeFactory.java 2018-04-02 20:55:36.000000000 -0700 +++ new/src/jdk.jextract/share/classes/com/sun/tools/jextract/AsmCodeFactory.java 2018-04-02 20:55:35.000000000 -0700 @@ -111,7 +111,9 @@ 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"); + } } /** @@ -234,6 +236,15 @@ } 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);