com.sun.tools.javac.jvm.ClassWriter 在 JDT 编译器中等效

com.sun.tools.javac.jvm.ClassWriter equivalent in JDT compiler

负责为 JDTCompiler 编写 class 文件的 class 是什么? class(es) 相当于 javac 的 com.sun.tools.javac.jvm.ClassWriter?

谢谢

为了结束循环也在这里让我引用我的 answer from the JDT Forum:

I don't know about com.sun.tools.javac.jvm.ClassWriter, but here are some pointers to class file writing in JDT:

Main protocol is org.eclipse.jdt.internal.compiler.ICompilerRequestor: called when compilation is done for one type. There are several implementations depending on the compilation mode, e.g., during batch compilation org.eclipse.jdt.internal.compiler.batch.BatchCompilerRequestor is used which calls back into org.eclipse.jdt.internal.compiler.batch.Main.outputClassFiles(CompilationResult). Within the IDE other requestors are used, just look at the type hierarchy of ICompilerRequestor.

Note that the above assumes, we already have the bytes, only need to write them to file. If instead you are looking for the class that assembles the byte array, have a look at org.eclipse.jdt.internal.compiler.codegen.CodeStream.