# 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 java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## 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(java.lang.Object)`