它是一种自动标记java包(子包,类,方法,成员)的整个内容为@Depracated
使用eclipse(最好)或任何其他工具(如果有太多文件来手动创建它)的方法。
You could use sed
to mark all classes in the current directory and below (tested in Cygwin). Navigate to the desired folder and run:
for file in $(find . -name *.java); do sed -i 's/\(public class\)/@Deprecated\n\1/g' $file; done
To also mark interfaces just add it like this:
for file in $(find . -name *.java); do sed -i 's/\(\(public class\|interface\)\)/@Deprecated\n\1/g' $file; done
EDIT
As @ŁukaszRzeszotarski points out, you can do this in Eclipse with the Search/Replace tool. Just mark the resources where you want to perform the operations, then press Ctrl + h
. Fill it out like this:
Then, press
Replace
, and fill it out like this:
All done!
Try creating a file called package-info.java
and deprecate the package.
@Deprecated
package foo;
Deprecating foo
and will not deprecate foo.bar
.
Tested on Java 7; Eclipse.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.