proposed patch for PR 72 (method lookup in interfaces)

Per Bothner per@bothner.com
Wed Nov 3 16:47:00 GMT 1999


Alexandre Petit-Bianco <apbianco@cygnus.com> writes:

> I agree some of the macros should be renamed. We should have a
> TYPE_DECL that transforms into a TYPE_NAME. CLASS_INTERFACE should be
> renamed to be CLASS_DECL_INTERFACE and we should write a
> CLASS_TYPE_INTERFACE.

Perhaps.  However, there is another consistency issue.  Consider
the "final" keyword.  That can apply to either a field, a method,
or a class.  Hence FIELD_FINAL, METHOD_FINAL, and CLASS_FINAL.
Fields and methods are decls;  hence FIELD_FINAL and METHOD_FINAL
need to apply to decls.  Classes are represented using *both*
a type and a decl.  One can get the type from the decl using
DECL_TYPE;  you can get the decl form the type using TYPE_NAME.
Essentially, you have one thing representing the information
about a class, except it is spread out into two tree nodes
(plus all the tree-nodes for the sub-parts).  Since a class
is presented using both a decl and a type, and since FIELD_FINAL
and METHOD_FINAL are operations of decls, it seemed reasonable
that CLASS_FINAL also be an operation on a decl.  And for
consistency the other CLASS_ access flags should also
apply to a decl.

That at least was the logic I followed.  To avoid confusion, I suggest
should be CLASSDECL_INTERFACE, not CLASS_DECL_INTERFACE (which might
be read as the DECL_INTERFACE of a class).  And a renaming should be
done consistently:  CLASS_FINAL would also have to be renamed
to CLASSDECL_FINAL.

That's a lot of work.  I doubt it's worthwhile.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


More information about the Java mailing list