我可以让 Java 5 忽略 @Override 错误吗? [英] Can I get Java 5 to ignore @Override errors?

查看:31
本文介绍了我可以让 Java 5 忽略 @Override 错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
为什么Eclipse会抱怨接口方法上的@Override?

我有一些使用 Eclipse 和 Java 6 SDK 编写的 Java 代码,因此实现接口的方法使用 @Override 进行了注释——该注释在 Java 6 中是合法的,但在 Java 6 中不合法Java 5.

I have some Java code that was written using Eclipse and the Java 6 SDK, so methods that implement an interface are annotated with @Override - an annotation that is legal in Java 6, but not in Java 5.

我想使用 Java 5 SDK(Mac OS X 10.5 上的 javac)编译相同的代码.除了 @Override 注释外,一切都可以正常编译和运行.有什么办法可以让 javac 忽略这个项目的 @Override 注释,或者是将它们全部删除的唯一解决方案?

I'd like to compile the same code using the Java 5 SDK (javac on Mac OS X 10.5). Everything compiles and runs fine except for the @Override annotations. Is there any way I can get javac to ignore the @Override annotations for this project, or is the only solution to remove them all?

推荐答案

显然你可以升级到 Java 1.5 u21,这将解决这个问题:

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

为什么 javac 在@Override 注释上失败

这篇关于我可以让 Java 5 忽略 @Override 错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆