在Java 1.6中弃用 [英] Deprecate in Java 1.6
本文介绍了在Java 1.6中弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Java 1.5中,要弃用一种方法,您将:
In Java 1.5, to deprecate a method you would:
@Deprecated int foo(int bar) {
}
在Java 1.6中进行编译会导致以下结果:
Compiling this in Java 1.6 results in the following:
语法错误,如果源级别为1.5,则仅
可用注释
Syntax error, annotations are only available if source level is 1.5
有什么想法吗?
推荐答案
您必须告诉编译器使用1.6:
You have to tell the compiler to use 1.6:
javac -source 1.6
或等价于您的IDE /构建系统(如其他人所建议)。
Or equivalent for your IDE/build system (as others have suggested).
这篇关于在Java 1.6中弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文