Status update: generic specializer
Paul Benedict
pbenedict at apache.org
Tue Aug 26 01:40:26 UTC 2014
On Mon, Aug 25, 2014 at 4:12 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> Third, think about the complexity consequences of "by opt-in, of course".
> Who gets to determine whether a give List<String> is an instance of erased
> List or some String-specific specialization that is not related to raw
> List? Do the two types -- List<unspecialized String> and List<specialized
> String> get spelled the same way? If so, we've then "erased" the
> distinction for anyone who didn't directly instantiate the thing, which is
> not so good. On the other hand, if they have to be spelled different ways,
> you've just made generics 2x more complicated. That doesn't seem so good
> either.
>
My off-the-cuff opinion is that I would split type parameters into declared
vs. actual type on Class<?>. The former exist today and reveal the current
erased types; the latter would be new and reveal the specialized
instantiated types. The former would still be the official spelling. I
don't know if it's important at this stage to differentiate the spelling.
At least I would just expect stricter runtime behavior so you couldn't
sneak in the wrong object type using erasure/reflection tricks.
More information about the valhalla-dev
mailing list