Java Reference
In-Depth Information
-enableassertions/-ea[
descriptor
]
Enables (turns on) assertion evaluation as defined by the
descriptor
. If there is no descriptor, assertions are enabled for
all classes except those loaded by the system class loadersee
"
Loading Classes
" on page
435
.
-disableassertions/-da[
descriptor
]
Disables (turns off) assertion evaluation for all classes as
defined by the
descriptor
. If there is no descriptor, assertions
are disabled for all classes.
The
descriptor
allows you to specify particular packages or classes that
will be affected by the option. An absent descriptor means the option
applies to all non-system classes (that is, classes loaded by any class
loader but the system class loader). Packages are defined by name, fol-
lowed by
...
which means to apply the option to all subpackages. For
example, the option
-enableassertions:com.acme...
would turn on assertions in all classes in
com.acme
and all its subpack-
ages. If the descriptor consists only of
...
it represents the unnamed
package in the current working directory. Without the
...
the descriptor
is assumed to be the full name of a class.
-enableassertions:com.acme.Plotter
turns on assertions for the class
com.acme.Plotter
. So if you want to turn
on all assertions in
com.acme
, but the class
com.acme.Evalutor
is not relev-
ant, you could say
-enableassertions:com.acme... -da:com.acme.Evaluator