我正在scala类上尝试javap-p类名,但在REPL中出现错误


scala> class Department( val departmentId: Int, val departmentName: String)
defined class Department
scala> javap -p Department
<console>:12: error: not found: value javap
javap -p Department
^
<console>:12: error: not found: value p
javap -p Department
^

您不能像在普通shell中一样调用javap程序,因为Scala REPL是而不是shell。

您可以使用内置命令:javap,不过:

scala> class Department( val departmentId: Int, val departmentName: String)
defined class Department
scala> :javap -p Department
Compiled from "<console>"
public class $line4.$read$$iw$$iw$Department {
private final int departmentId;
private final java.lang.String departmentName;
public int departmentId();
public java.lang.String departmentName();
public $line4.$read$$iw$$iw$Department(int, java.lang.String);
}

来自REPL:help:

:javap <path|class>反汇编文件或类名

相关内容

  • 没有找到相关文章

最新更新