Can I get Java 5 to ignore @Override errors? [duplicate]

佐手、 提交于 2019-11-28 13:24:25
skiphoppy

Apparently you can upgrade to Java 1.5 u21 and this will fix the problem:

Why is javac failing on @Override annotation

Unfortunately, the only way is to actually remove the annotations.

If you do want to have your code compile and run with Java 5, you should develop targeting Java 5. Otherwise, you might accidentally rely on a Java 6 specific SDK methods and such.

You can use JDK6 to compile 1.5 code. Use -bootclasspath, -target, and -source. Alternatively, I believe the Eclipse compiler treats @Override the same (this might be wrong!).

1.5 has finished its End of Service Life period, and I suggest letting it rot.

@Override is valid in java 5 -> http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/lang/Override.html

I recommend that you check your project's compiler settings in Eclipse, perhaps at Project -> Compiler -> Error/Warnings -> Annotations?

Java 6 is available for OS X. Check software update. When you have it, set it to be the default java version, and then compile.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!