8

In Java 9 a new tool jdeprscan has been introduced, which is quite similar to the existing jdeps tool.

As per my understanding jdeprscan's primary motive is to harness the usage of 'for-removal' & 'release' attributes of the Deprecated annotation.

Is there any other scenario or usage for this tool, which cannot be performed using JDeps?

Naman
  • 27,789
  • 26
  • 218
  • 353
Curious Coder
  • 646
  • 8
  • 18

2 Answers2

8

Your understanding in terms of what jdeprscan does is correct. The jdeprscan tool is precisely meant for

static analysis scanning a JAR file or some other aggregation of class files for uses of deprecated API elements.

It's also important to note that

The deprecated APIs identified by the jdeprscan tool are only those that are defined by Java SE. Deprecated APIs defined by third-party libraries aren’t reported.


Though, IMO you shall also understand that there is no comparison of the tool with jdeps, which on the other hand is not meant to identify deprecated APIs but instead analyze the dependencies of a class/package.

In short, they are exclusive in functionality.

Naman
  • 27,789
  • 26
  • 218
  • 353
2

Unlike jdeps, jdeprscan only exists as a command line tool, and does not provide any direct API.

Oleksandr Pyrohov
  • 14,685
  • 6
  • 61
  • 90
  • 4
    sample `Optional javac = ToolProvider.findFirst("jdeps"); int javacRun = javac.get().run( System.out, System.err, "--help" );` that would not run if we replace jdeps with jdeprscan. – Naman Feb 07 '18 at 11:11