Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个混合 Java/Scala 的项目,它是使用 Scala 库的 Java GUI 代码。有没有办法编写 Scala 代码,使其在编译时发出 Java 枚举?到目前为止我尝试过的方法(密封案例类,扩展枚举)似乎生成了普通类,这使得从 Java 中使用它们比直接枚举要复杂得多。
为什么你不能用 Java编写你的enum类?混合源(即Java + Scala)项目是完全可行的......
enum
Scala 目前仅支持 Java 1.4 特性。
Java 枚举是在 Java 1.5 中引入的。