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

$ as a legal identifier character _and_ as an internal inner class separator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 1.1.4
    • tools
    • x86
    • windows_95



      Name: dgC58589 Date: 12/02/97


      The Java people have decided to allow the `$'-character (dollar) as a
      valid part of identifiers, even if Java is quite distant from perl and
      shell scripts. Now they have also decided to use the same character as
      an internal separator between outer and inner classes. This may give
      trouble, as in this artificial example:

      -FILE: Some.java----------------------------------------------------------
      class Some$Clazz { /* gives the file Some$Clazz.class */
      }

      /* trouble: Some.Clazz is represented internally (and on file) as
       * Some$Clazz, and strangely enough, $ is a legal identifier character
       * (as seen above). Kabom! */
      class Some { /* gives the file Some.class */
          class Clazz { /* gives the file Some$Clazz.class too! */
          }
      }

      /* compilation gives:
       * Some.java:8: Class Some. Clazz already defined in Some.java.
       * class Clazz {
       * ^
       * 1 error */
      --------------------------------------------------------------------------

      Wonder if someone is interested in fixing this, and in that case, how
      they will retain backward compatibility of compiled code. :-)

      NOTE: I did this on Blacdown's port of JDK 1.1.3 to Linux, but
      I guess the problem is valid for all implementations of
      JDK 1.1.x.
      (Review ID: 21187)
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            dgrahamcsunw David Graham-cumming (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: