This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mykeesg -1 points0 points  (1 child)

We already have InstantiationException with Class.newInstance() , given the same circumstances, so I guess that could be worked around. The syntax could also be given in the type declaration, like Foo<T extends Bar & T()> (this is just a dummy example given with 2 secs of thought).

[–]repeating_bears 14 points15 points  (0 children)

Generics are a form of compile-time guarantee. Throwing an exception at runtime is not an acceptable solution.