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

Specification required for mapping from class names to file names

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Future Project
    • Affects Version/s: 1.0.2, 1.1, 1.1.3, 1.1.6, 1.1.8, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.4.0, 1.4.2, 5.0, 6u26
    • Fix Version/s: None
    • Component/s: specification
    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.6, solaris_7, solaris_8, windows_95, windows_98, windows_nt, windows_2000, windows_7

      Description

      To "write once run anywhere" it is necessary to have a defined mapping from
      class name to the file name that will contain the class. The absence of a
      strategy to address this issue results in unresolveable bugs and
      interoperability failure on all platforms.

      The mapping needs to be specified, rather than a choice of the implementation, in order for implementations on the same platform to be interoperable.

      Some examples of the problems that need to be solved by a platform-specific specfication of the class name to file name mapping:

      (1) Win32 and liks platforms are not case sensitive, while Java
      identifiers are.
      (2) The unix limit on the total length of a filename is much
      shorter than the limit on the length of a qualified Java identifier.
      (3) Java identifiers include unicode characters; none of the target
      file systems do.

      A further problem arises because the tools we provide to produce jar files
      may have to be aware of this mapping to undo it.

      Here is a sample program which the available specifications do not
      give enough information to tell a compiler how to behave:

      frog$ cat -n T.java
           1 /** doc for T */
           2 public class T {
           3 /** doc for id\u0ca0\u0ca1 */
           4 public static class id\u0ca0\u0ca1 {
           5 public void f() {}
           6 }
           7 /** doc for id\u0ca1\u0ca0 */
           8 public static class id\u0ca1\u0ca0 {
           9 public void g() {}
          10 }
          11 public static void main(String[] args) {
          12 new id\u0ca0\u0ca1().f();
          13 new id\u0ca1\u0ca0().g();
          14 }
          15 }
      frog$

      One suggestion would be to use a cryptographically strong hash function to
      hash the class name to 256 bits and encode those bits to a filename that
      is acceptable on all platforms.

      neal.gafter@Eng 2001-03-05

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abuckley Alex Buckley
              Reporter:
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: