Suggestions for Java Generics Semantics in Java Version 7.0 _ Resurrected

Jaisimha Narahari jcnarahari at
Wed Jun 17 01:15:38 PDT 2009

Much as I would not like to harp on something which seems to have been already belabored at length, the lack of an appropriate priority on the issue of  having Reified Generics in Java 7 is very puzzling. 

All the more so, since, as noted in the last post, this issue has been in Sun's Bug Database for  nearly four years (the earliest entry is dated  29-SEP-2004). 

Under  Bug ID 5098163 in which this issue has been identified as a definite bug, against "Evaluation",  you find   --> "Under discussion as a potential feature in Java SE 7."

Also under "Priority" it is --> "4-Low"

I could not find any other entry that indicated further action taken, nor the current status, maybe on account of the low priority assigned to this bug, as seen above. 

I sincerely feel that this issue of having Reified Generics in Java 7 is Too Important to be given low priority status, not withstanding the discussions in all the previous posts in this mailing list.

So I would like to revive a plea for it one last time.

Firstly, a bug is, well A BUG. It is a no-brainer then that FIXING BUGS SHOULD TAKE HIGHER PRIORITY OVER OVER NEW FEATURES. 
Secondly, since the reason for continuing with Raw Types is only Backward Compatibility, the changes required to javac, the JVM, and the APIs  to accomodate Reified Generics are definitely not enormous. Only the impact of such a change is considered to be enormous, due to Legacy Code.

There are entries in the Bug Database that plead for Reified Generics ( I reproduce the URL here, for anyone wanting to look up:

One particular entry in the bugs database I reproduce here, partially:
("solmyr72", if you are reading this, I sincerely hope you don't mind my quoting you without your permit):

Submitted On 06-MAY-2006 
Please, please fix this !


3) If backwards compatibility is that important to you, how about adding some compiler flag, to turn off reification ? 

> java  -noReification  ...

The above flag can also be used with javac, so that compile time treatment of Raw types can continue to exist as the do now.

A flag like this seems to be a pointer as to how we can eat the cake and have it too. 

Legacy Code users go for Raw Type treated as valid by both javac and the JVM (with the above flag specified)

All others, take the DEFAULT BEHAVIOUR of both JAVAC and the JVM, which SUPPORT ONLY REIFIED GENERICS (with the above flag not specified).

Third, let's get to the fundamentals. An "Object Oriented Program" deals with "Objects". Objects happen to be instances of "Types". So Types are the core of OOP. "Erasure" followed in the implementation of Generics ERASES TYPES.

An OOP  language that erases partially the core concept on which it is based cannot make for a very good specimen of the genre.

It is not so much about the language being ideal, it is about the mess it creates with the type system as a consequence.

In an OOP language, we have a situation where the wholesome type of Generics (their Base Type together with all their Type Parameters) cannot be part of Inheritance Hierarchy in the normal way (that is, with the Type Parameters also deciding the Hierarchy - they are also types, after all). 

And, Arrays of these Generic Types cannot be created.

If you really think about this , these two restrictions can practically "suffocate" Generic Types and prevent their usage in many contexts.


As seen above, it may be possible to have  dual semantics in operation with the help of a flag, and still support Raw Types.

The time to act is NOW, because, Legacy Code only builds up as days go by. 

Hence this plea for inclusion in Java 7.

If deadlines suffer as a result, a delay in the release of Java 7 is definitely worth it, knowing that the delivered productwill be robust and elegant.

I rest my case.


More information about the jdk7-dev mailing list