The compiler will do an inference based on actual arguments. It will start out with the initial constraints of Matcher<Object> << Matcher<? super T>
and Matcher<SomeException> << Matcher<? super T>
. From that it will infer the constraints T << Object
and T << SomeException
. Object
will be eliminated when the minimal erased candidate set is constructed. The remaining candidate SomeException
will (eventually :D) be substituted for T
.
So far we've shown eclipse and JDK7 behave correctly in this case. I don't think there is any way to force javac to behave correctly as well. You can either explicitly state the type argument or use JDK7 (specifying source and target to be 6).