# Class AccessControlContext

java.lang.Object
java.security.AccessControlContext

@Deprecated(since="17", forRemoval=true) public final class AccessControlContext extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
This class was only useful in conjunction with the the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this class.
`AccessControlContext` was used with the Security Manager for access control decisions based on context that it encapsulated. This feature no longer exists.

Since:
  1.2

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AccessControlContext(AccessControlContext acc, DomainCombiner combiner)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Create a new `AccessControlContext` with the given `AccessControlContext` and `DomainCombiner`.
  `AccessControlContext(ProtectionDomain[] context)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Create an `AccessControlContext` with the given array of `ProtectionDomain` objects.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkPermission(Permission perm)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Throws `AccessControlException`.
  `boolean`
  `equals(Object obj)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Checks two `AccessControlContext` objects for equality.
  `DomainCombiner`
  `getDomainCombiner()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Get the `DomainCombiner` associated with this `AccessControlContext`.
  `int`
  `hashCode()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Returns the hash code value for this context.

  ### Methods declared in class Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### AccessControlContext

    public AccessControlContext(ProtectionDomain[] context)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an `AccessControlContext` with the given array of `ProtectionDomain` objects. Context must not be `null`. Duplicate domains will be removed from the context.
    Parameters:
      `context` - the `ProtectionDomain` objects associated with this context. The non-duplicate domains are copied from the array. Subsequent changes to the array will not affect this `AccessControlContext`.
    Throws:
      `NullPointerException` - if `context` is `null`

  - ### AccessControlContext

    public AccessControlContext(AccessControlContext acc, DomainCombiner combiner)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a new `AccessControlContext` with the given `AccessControlContext` and `DomainCombiner`. This constructor associates the provided `DomainCombiner` with the provided `AccessControlContext`.
    Parameters:
      `acc` - the `AccessControlContext` associated with the provided `DomainCombiner`.
      `combiner` - the `DomainCombiner` to be associated with the provided `AccessControlContext`.
    Throws:
      `NullPointerException` - if the provided `context` is `null`.
    Since:
      1.3

- ## Method Details

  - ### getDomainCombiner

    public DomainCombiner getDomainCombiner()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the `DomainCombiner` associated with this `AccessControlContext`.
    Returns:
      the `DomainCombiner` associated with this `AccessControlContext`, or `null` if there is none.
    Since:
      1.3

  - ### checkPermission

    public void checkPermission(Permission perm) throws AccessControlException
    Deprecated, for removal: This API element is subject to removal in a future version.
    Throws `AccessControlException`.
    Parameters:
      `perm` - ignored
    Throws:
      `AccessControlException` - always

  - ### equals

    public boolean equals(Object obj)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Checks two `AccessControlContext` objects for equality. Checks that `obj` is an `AccessControlContext` and has the same set of `ProtectionDomain` objects as this context.
    Overrides:
      `equals` in class `Object`
    Parameters:
      `obj` - the object we are testing for equality with this object.
    Returns:
      `true` if `obj` is an `AccessControlContext`, and has the same set of `ProtectionDomain` objects as this context, `false` otherwise.
    See Also:
      - `Object.hashCode()`
      - `HashMap`

  - ### hashCode

    public int hashCode()
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the hash code value for this context. The hash code is computed by exclusive or-ing the hash code of all the protection domains in the context together.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      the hash code value for this context
    See Also:
      - `Object.equals(java.lang.Object)`
      - `System.identityHashCode(Object)`