from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209586

userrating:


May 25th. 2007:
Words

486

Views

258592

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149883

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





JDEPRSCAN

Section: JDK Commands (1)
Updated: 2023
Index Return to Main Contents
 

NAME

jdeprscan- static analysis tool that scans a jar file (or some other aggregation of class files) for uses of deprecated API elements  

SYNOPSIS

V]jdeprscanR] [I]optionsR]] {I]dirR]|I]jarR]|I]classR]}

I]optionsR]
See B]Options for the jdeprscan CommandR]
I]dirR]|I]jarR]|I]classR]
V]jdeprscanR] command scans each argument for usages of deprecated APIs. The arguments can be a:
[bu]
I]dirR]: Directory
[bu]
I]jarR]: JAR file
[bu]
I]classR]: Class name or class file

The class name should use a dot (V].R]) as a separator. For example:

V]java.lang.ThreadR]

For nested classes, the dollar sign V]$R] separator character should be used. For example:

V]java.lang.Thread$StateR]

A class file can also be named. For example:

V]build/classes/java/lang/Thread$State.classR]

 

DESCRIPTION

The V]jdeprscanR] tool is a static analysis tool provided by the JDK that scans a JAR file or some other aggregation of class files for uses of deprecated API elements. The deprecated APIs identified by the V]jdeprscanR] tool are only those that are defined by Java SE. Deprecated APIs defined by thir-party libraries aren[aq]t reported.

To scan a JAR file or a set of class files, you must first ensure that all of the classes that the scanned classes depend upon are present in the class path. Set the class path using the V-clas-pathR] option described in B]Options for the jdeprscan CommandR]. Typically, you would use the same class path as the one that you use when invoking your application.

If the V]jdeprscanR] can[aq]t find all the dependent classes, it will generate an error message for each class that[aq]s missing. These error messages are typically of the form:

V]error: cannot find class ...R]

If these errors occur, then you must adjust the class path so that it includes all dependent classes.  

OPTIONS FOR THE JDEPRSCAN COMMAND

The following options are available:

V-clas-pathR] I]pathR]
Provides a search path for resolution of dependent classes.

I]pathR] can be a search path that consists of one or more directories separated by the syste-specific path separator. For example:

[bu]
B]Linux and macOS:R]

V-clas-path /some/directory:/another/different/dirR]

B]Note:R]

On Windows, use a semicolon (V];R]) as the separator instead of a colon (V]:R]).

[bu]
B]Windows:R]

V-clas-path [rs]some[rs]directory;[rs]another[rs]different[rs]dirR]

V-fo-removalR]
Limits scanning or listing to APIs that are deprecated for removal. Can[aq]t be used with a release value of 6, 7, or 8.
V-ful-versionR]
Prints out the full version string of the tool.
V-helpR] or V-hR]
Prints out a full help message.
V-listR] or V-lR]
Prints the set of deprecated APIs. No scanning is done, so no directory, jar, or class arguments should be provided.
V-releaseR] V]6R]|V]7R]|V]8R]|V]9R]
Specifies the Java SE release that provides the set of deprecated APIs for scanning.
V-verboseR] or V-vR]
Enables additional message output during processing.
V-versionR]
Prints out the abbreviated version string of the tool.
 

EXAMPLE OF JDEPRSCAN OUTPUT

The JAR file for this library will be named something similar to V]common-math-3.6.1.jarR]. To scan this JAR file for the use of deprecated APIs, run the following command:

V]jdeprscan common-math-3.6.1.jarR]

This command produces several lines of output. For example, one line of output might be:

CB]
class org/apache/commons/math3/util/MathUtils uses deprecated method java/lang/Double::<init>(D)V
R]

B]Note:R]

The class name is specified using the slas-separated binary name as described in JVMS 4.2.1. This is the form used internally in class files.

The deprecated API it uses is a method on the V]java.lang.DoubleR] class.

The name of the deprecated method is V]<init>R], which is a special name that means that the method is actually a constructor. Another special name is V]<clinit>R], which indicates a class static initializer.

Other methods are listed just by their method name. Following the method name is the argument list and return type:

V](D)VR]

This indicates that it takes just one double value (a primitive) and returns void. The argument and return types can become cryptic. For example, another line of output might be:

CB]
class org/apache/commons/math3/util/Precision uses deprecated method java/math/BigDecimal::setScale(II)Ljava/math/BigDecimal;
R]

In this line of output, the deprecated method is on class V]java.math.BigDecimalR], and the method is V]setScale()R]. In this case, the V](II)R] means that it takes two V]intR] arguments. The V]Ljava/math/BigDecimal;R] after the parentheses means that it returns a reference to V]java.math.BigDecimalR].  

JDEPRSCAN ANALYSIS CAN BE VERSIO-SPECIFIC

You can use V]jdeprscanR] relative to the previous three JDK releases. For example, if you are running JDK 9, then you can check against JDK 8, 7, and 6.

As an example, look at this code snippet:

CB]
public class Deprecations {
   SecurityManager sm = new RMISecurityManager();    // deprecated in 8
   Boolean b2 = new Boolean(true);          // deprecated in 9
}
R]

The complete class compiles without warnings in JDK 7.

If you run V]jdeprscanR] on a system with JDK 9, then you see:

CB]
$ jdeprscan-clas-path classes-release 7 example.Deprecations
(no output)
R]

Run V]jdeprscanR] with a release value of 8:

CB]
$ jdeprscan-clas-path classes-release 8 example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
R]

Run V]jdeprscanR] on JDK 9:

CB]
$ jdeprscan-clas-path classes example.Deprecations
class example/Deprecations uses type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method in type java/rmi/RMISecurityManager deprecated
class example/Deprecations uses method java/lang/Boolean <init> (Z)V deprecated
R]


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS FOR THE JDEPRSCAN COMMAND
EXAMPLE OF JDEPRSCAN OUTPUT
JDEPRSCAN ANALYSIS CAN BE VERSION-SPECIFIC





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 14.0 ms