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

Extend import to allow renaming of imported type

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0, 1.3.0, 1.4.1, 1.4.2
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_2000

      Description

      Name: igT44549 Date: 02/24/99


      If a compilation unit needs to import two types residing in
      different packages but with the same name, then each reference
      to at least one of the types must be fully qualified.

      To prevent client developers from having to fully qualify names,
      library developers should make each importable type name unique,
      defeating one of the goals of the package mechanism.

      A compile-time mechanism to allow renaming of modules on import
      would prevent this. For example:

      import java.util.Date;
      import java.sql.Date as SQLDate;

      The ability to rename on import would not obfuscate source code,
      since a reader needs to review the module import declarations
      anyway to know the origin of the types being used. It would
      simplify code that uses different types with the same name.

      This enhancement should require only minimal changes to the
      compiler and to javadoc.
      (Review ID: 48501)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abuckley Alex Buckley
                Reporter:
                iris Iris Clark
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: