-
Bug
-
Resolution: Unresolved
-
P4
-
8
The lub of two types sometimes produces a lower-bounded wildcard of the form '? super glb(S, T)'. The types S and T can be arbitrary types; in general, glb(S,T) may be undefined (for example, if S and T are unrelated classes). When this occurs, the lub is, in turn, undefined.
Since the purpose of glb in this context is just to provide some extra typing information, in the case of incompatible types, probably the right way to recover is to use an unbounded wildcard.
Examples:
lub(List<? super Runnable>, List<? super Cloneable>) = List<? super Runnable & Cloneable>
lub(List<? super String>, List<? super Integer>) = List<?> (incompatible glb)
Since the purpose of glb in this context is just to provide some extra typing information, in the case of incompatible types, probably the right way to recover is to use an unbounded wildcard.
Examples:
lub(List<? super Runnable>, List<? super Cloneable>) = List<? super Runnable & Cloneable>
lub(List<? super String>, List<? super Integer>) = List<?> (incompatible glb)