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

Extend import to allow renaming of imported type

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.2.0, 1.3.0, 1.4.1, 1.4.2
    • specification
    • generic, x86
    • generic, linux, windows_2000

      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)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: