在IntelliJ中,有没有办法在字节码查看器中修改反编译的class?

In IntelliJ, is there a way to modify the decompiled class in the bytecode viewer?

默认情况下,字节码查看器处于只读模式。

有没有办法修改代码并保存到新的 class 文件?

有个插件叫Bytecode Editor:

Provides View | Edit Bytecode action for those who learns JVM internals.

Based on ByteCode Viewer by JetBrains but is better:

  • it uses an editor tab instead of a popup
  • it allows you to edit bytecode assembler and assemble edited code back into .class files
  • it provides default hotkey for bytecode analysis: Ctrl+K, Ctrl+B