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

URL final class has protected methods

XMLWordPrintable

    • b82
    • x86
    • linux
    • Verified



      Name: jl125535 Date: 06/18/2003


      FULL PRODUCT VERSION :
      Java Hotspot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      See http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html.
      The URL class is declared final yet has two protected methods:

      protected void set(String protocol,
                         String host,
                         int port,
                         String file,
                         String ref)

      protected void set(String protocol,
                         String host,
                         int port,
                         String authority,
                         String userInfo,
                         String path,
                         String query,
                         String ref)


      Since the final class can't be subclassed these methods
      can't be accessed.
      They could be package protected instead. (i.e. no access
      specifier)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      This is a minor issue, but you could hide these methods and
      thus make the URL class a little simpler and easier to
      comprehend. Since no one can use these methods anyway, there
      would be no backwards compatibility issues.
      (Review ID: 179367)
      ======================================================================

            jzavgren John Zavgren (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: