Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354406

Deprecate URL::getPermission method and networking permission classes for removal

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • core-libs
    • None
    • source
    • minimal
    • Hide
      Compiling source files that use the deprecated classes or APIs will generate warnings.
      There is no change in the behavior of the deprecated classes or methods.
      Show
      Compiling source files that use the deprecated classes or APIs will generate warnings. There is no change in the behavior of the deprecated classes or methods.
    • Java API
    • SE

      Summary

      Permission classes used by the now removed Security Manager are deprecated for removal including NetPermission, NetworkPermission, SocketPermission, URLPermission. The URL::getPermission method serves little purpose and is also deprecated for removal.

      Problem

      Now that JEP 486 has been integrated and the Security Manager is permanently disabled, the following permission classes in the core libraries are no longer useful: NetPermission, NetworkPermission, SocketPermission, URLPermission. Some public subclasses of URLConnection are overriding the URLConnection::getPermission method and are specified to return instances of the deprecated permission classes. As such, the URLConnection::getPermission method should also be deprecated for removal in URLConnection and its subclasses.

      Solution

      The following classes in the public API are deprecated for removal:

      • java.net.NetPermission,
      • jdk.net.NetworkPermission,
      • java.net.SocketPermission,
      • java.net.URLPermission

      The following methods in the public API are deprecated for removal:

      • java.net.URLConnection::getPermission
      • java.net.HttpURLConnection::getPermission

      Specification

      For the classes NetPermission, NetworkPermission, SocketPermission, URLPermission, each class adds the annotation indicating the deprecation for removal.

      @Deprecated(since = "25", forRemoval = true)

      The '@apiNote' in each class is changed to '@deprecated' so that the javadoc for each class includes the text:

      Deprecated, for removal: This API element is subject to removal in a future version.

      The existing text describing the deprecation is retained:

      This permission cannot be used for controlling access to resources as the Security Manager is no longer supported.

      For URLConnection::getPermission and HttpURLConnection::getPermission, each method adds the annotation indicating the deprecation for removal:

      @Deprecated(since = "25", forRemoval = true)

      In addition an @deprecated tag is added to the API documentation of the methods:

      For URLConnection::getPermission:

          /**
           * [...]
           * @deprecated
           * Permissions can no longer be used for controlling access to resources
           * as the Security Manager is no longer supported.
           */
          @Deprecated(since = "25", forRemoval = true)
          public Permission getPermission() throws IOException {

      For HttpURLConnection::getPermission:

          /**
           * [...]
           * @deprecated
           * Permissions can no longer be used for controlling access to resources
           * as the Security Manager is no longer supported.
           */
          @Deprecated(since = "25", forRemoval = true)
          public Permission getPermission() throws IOException {

            dfuchs Daniel Fuchs
            mullan Sean Mullan
            Daniel Jelinski, Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: