Static fields in specialized classes

Stephen Colebourne scolebourne at joda.org
Wed Oct 15 15:11:10 UTC 2014


On 15 October 2014 15:19, Brian Goetz <brian.goetz at oracle.com> wrote:
> The fundamental question for an implementation of generics is the mapping
> between types and classes.  (List<String> is a type; List.class is a class.)

Isn't the issue that the class concept is being split into two
different meanings?

List<String> is a type (unchanged)
List<int> and List<T> are distinct bytecode units
List is the single piece of source code and overall concept

Are we not debating which of the last two the current Class concept
best maps to?

I'm arguing that it is the concept that I want to refer to in code
(instanceof, method signature, overloads), as that is far more common
than a need to think about the bytecode unit (reflection).


> In Java 5, all instantiations of List<X>, for reference X, mapped to class
> List.class; this is an all-to-1 mapping.  This is simple but everyone seems
> to think this is smelly and complains about it a lot.

I think those are mostly "noise" complaints. Developers have fully
internalised this all to 1 mapping at this point and I'd disagree with
the "everyone complains" statement.

Stephen


More information about the valhalla-dev mailing list