2018-10-19

Java 9 : jdeprscan

This tool is used for scanning the usage of deprecated APIs in a given JAR file,
classpath, or source directory. Suppose we have a simple class that makes use of the
deprecated method, addItem, of the  java.awt.List class, as follows:

import java.awt.List;
public class Test{
public static void main(String[] args){
List list = new List();
list.addItem("Hello");
}
}

Compile the preceding class and then use jdeprscan, as follows:

C:Program FilesJavajdk-9bin>jdeprscan.exe -cp . Test

You will notice that this tool prints out class Test uses method java/awt/List addItem (Ljava/lang/String;) deprecated, which is exactly what we expected.

No comments:

Post a Comment