Hi!
I'd like to promise certain things about the parameter of a generic:
public class Foo<Bar implements Something> {
...
}
but that's a syntax error immediately -- javac expects a closing `>' right
where the space after `Bar' is in the above example...
How can I do this -- so that I can rely on Bar's features inside Foo and
have the compiler enforce the possible Bar's compliance?
Thanks!
-mi
Joshua Cranmer - 30 Apr 2008 22:07 GMT
> Hi!
>
[quoted text clipped - 3 lines]
> ...
> }
how about:
public class Foo<Bar extends Something> {
Note that this works if `Something' is a class or if it is an interface.

Signature
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth