Shouldn't autoboxing work with inferred parameter types?
For example, I have:
class Pair<T,U> {
public <T,U> static Pair<T,U> make( T t, U u ) {
returnnew Pair( t, u );
}
Pair( T t, U u ) {
first = t;
second = u;
}
private T first;
private U second;
}
and when I try:
Pair.make( "Hello", 500 );
I'm told that the inferred arguments, java.lang.String and int do not conform to the bounds of the type variables. I'd like autoboxing/inference to work together to "do the right thing" here.
That works fine, but I don't understand your point. I'm asking for autoboxing to work with inferred type parameters. You're explicitly specifying them.
No, I agree that inference should work. (And I've added this to the list of bugs at http://cscott.net/Projects/GJ#bugs ). I was just curious whether autoboxing would work given the correct results of inference. It seems it does. So it really is only an inference problem.