Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] No java model representation for anonymous classes and named local classes

It was suggested to me that the reason why there is no java model
representation for anonymous classes and named local classes is that there
is no obvious or reasonable way to assign such a class a global identity
that would persist across parses of different editions of the class'
containing compilation unit.  By this I mean that there is no obvious and
reasonable way to determine whether such a class is "the same class as" a
class found in a subsequent parse of a different edition of the same
compilation unit.

This suggestion led me come upon the idea that, in the design of a Java
Model like that of JDT, it could be possible to have Java elements which do
not have a global identity that persists across parses of the compilation
unit in which they occur, and that this could likely be a reasonable way to
treat anonymous and named local classes.  An IJavaElement representing such
a class could cease to "exist" (i.e. !element.exists()) after a parse of a
differing edition of the same compilation unit and a new element could come
into existence as a child of the same parent.

In fact, it appears that there may already be elements with some of these
properties.  IInitializer elements represent stand-alone instance or class
(static) initializers in a type.  As in the case of anonymous and local
classes, there does not appear to be any obvious or reasonable way to
assign an initializer a global identity that would persist across parses of
differing editions of the compilation unit.

So, with awareness of what is written above, what is the reason why there
is no java model representation for such classes?



Back to the top