Generics: accessing type parameters' type parameters
David Walend
david at walend.net
Wed Jul 4 09:49:37 PDT 2007
I'd like to start work on a KSL project to get dot access to type
parameters' type parameters like I described last year in
http://weblogs.java.net/blog/dwalend/archive/2006/05/
tilting_at_the_1.html .
I spent some time poking around the compiler code and the Java
language specification. I think getting the specification right will
be harder. And I haven't touched language/compiler work since a class
in grad school ten years ago.
I think the most relevant section in the language specification is
the section on Reference Types and Values at http://java.sun.com/docs/
books/jls/third_edition/html/typesValues.html#4.3 . That section lays
out some simple rules, and looks like the right place to touch.
I think I need to augment TypeVariable with something like
TypeVariableSpecifier:
TypeVariable
TypeVariableSpecifier . TypeVariable
, change ReferenceType to
ReferenceType:
ClassOrInterfaceType
TypeVariableSpecifier
ArrayType
and add a note along these lines:
"In a TypeVariable, a dot-accessed TypeVariable must resolve to the
name of a TypeParameter within the context of the outer TypeVariable."
How close is that to what needs to be there?
Is using TypeVariables directly this way OK? Or should I imitate
TypeName and define the works using Identifiers?
Should I do anything for accessible member types (inner classes and
their kin) in the dot expansion?
Thanks,
Dave
David Walend
david at walend.net
More information about the compiler-dev
mailing list