[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java.lang.Class inner class methods
From: |
Eric Blake |
Subject: |
Re: java.lang.Class inner class methods |
Date: |
Thu, 2 Aug 2001 11:50:11 +0100 |
Not so. '$' is a legal identifier character, so I can compile a non-inner
class as follows:
class X$Y {}
In order to detect inner classes in the VM (or in a compiler when reading
.class files), you MUST read the attributes, rather than relying on the
naming convention in the inner class specification.
It would be nice if Sun would give compilers a guaranteed namespace that
cannot conflict with user identifiers, but that has not happened yet...
Original message:
Thu, 2 Aug 2001 11:22:54 +0200 (MET DST)
The inner class "Y" of class "X" is compiled as "X$Y".
So if a class name contains "$", it must be an innerclass.
This is documentend in the Innerclass specification,
http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclass
es.doc.html
in section "Class Name Transformation"
http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclass
es.doc7.html
-Patrik
--
Eric Blake, Elixent, Castlemead, Lwr Castle St., Bristol BS1 3AG, UK
address@hidden tel:+44(0)117 917 5611