A technique in accordance with one embodiment of the present invention
provides introspection support for anonymous and local classes. As a
result of the technique, an enclosing class that defines a generic type
variable that is not defined within a local or anonymous class that
refers to the generic type variable can be determined. According to one
embodiment of the invention, when a compiler determines that a particular
class is a local or anonymous class, the compiler emits, into the
particular class' binary class file, information that indicates which
class encloses the particular class. In response to the invocation of a
method (described herein) relative to a reflective proxy that corresponds
to an enclosed class, information that identifies an enclosing class that
encloses the enclosed class is returned. This is so even if the enclosed
class is a local or anonymous class.