Share via


ClassLoader.SetPackageAssertionStatus(String, Boolean) Method

Definition

Sets the package default assertion status for the named package.

[Android.Runtime.Register("setPackageAssertionStatus", "(Ljava/lang/String;Z)V", "GetSetPackageAssertionStatus_Ljava_lang_String_ZHandler")]
public virtual void SetPackageAssertionStatus (string? packageName, bool enabled);
[<Android.Runtime.Register("setPackageAssertionStatus", "(Ljava/lang/String;Z)V", "GetSetPackageAssertionStatus_Ljava_lang_String_ZHandler")>]
abstract member SetPackageAssertionStatus : string * bool -> unit
override this.SetPackageAssertionStatus : string * bool -> unit

Parameters

packageName
String

The name of the package whose package default assertion status is to be set. A null value indicates the unnamed package that is "current" (see section 7.4.2 of <cite>The Java&trade; Language Specification</cite>.)

enabled
Boolean

true if classes loaded by this classloader and belonging to the named package or any of its subpackages will have assertions enabled by default, false if they will have assertions disabled by default.

Attributes

Remarks

Sets the package default assertion status for the named package. The package default assertion status determines the assertion status for classes initialized in the future that belong to the named package or any of its "subpackages".

A subpackage of a package named p is any package whose name begins with "p.". For example, javax.swing.text is a subpackage of javax.swing, and both java.util and java.lang.reflect are subpackages of java.

In the event that multiple package defaults apply to a given class, the package default pertaining to the most specific package takes precedence over the others. For example, if javax.lang and javax.lang.reflect both have package defaults associated with them, the latter package default applies to classes in javax.lang.reflect.

Package defaults take precedence over the class loader's default assertion status, and may be overridden on a per-class basis by invoking #setClassAssertionStatus(String, boolean).

Android-note: AssertionStatuses are unsupported. This method is a no-op.

Added in 1.4.

Java documentation for java.lang.ClassLoader.setPackageAssertionStatus(java.lang.String, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to