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)
======================================================================
- duplicates
-
JDK-4094180 # Synthetic names can conflict with explicit declaration
- Closed
- relates to
-
JDK-4098167 Use of '$' by inner classes conflicts with uses permitted by JLS
- Closed