1

有没有办法通过 AspectJ 编译来获取源文件?因此,ajc 不是获取字节码,而是作为预处理器工作,生成可以用 javac 编译的 Java 源代码?

4

1 回答 1

5

Since version 1.2 AspectJ has been a bytecode transformer, not a source transformer. For any recent version you cannot get sources directly out of AspectJ. You could use a decompiler/disassembler to go from the compiled bytecode back to sources but those sources may not look pretty.

You don't have to compile your aspects with the rest of your application code if that is your concern (i.e. that you want to build your app with javac)? You can compile your application with javac and then apply the aspects directly to the bytecode that javac produced in a binary weaving step.

于 2014-08-08T21:42:14.210 回答