且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java泛型代码在eclipse中编译但不在命令行中

更新时间:2023-02-22 11:15:24

单独的编译器... == 的使用强制更严格的编译时检查,因此在 CL 中它强制执行类型比较和错误.在 Eclipse 中,您可以管理编译时的设置并放宽限制.

Separate compilers...The use of == forces a stricter compile time check, therefore in the CL it is enforcing type comparison and erroring. In Eclipse you can manage the settings for the compile time and loosen the restrictions so to speak.

您可以尝试 Enum.equals() 并且它可能不会强制执行如此严格的编译时类型比较.只是一个想法.

You can try Enum.equals() and it may not enforce such strict compile time type comparison. just a thought.