-
Notifications
You must be signed in to change notification settings - Fork 1.7k
make int implement Comparable<int>? #8741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This seems like a bug in subtype tests? A class that implements Comparable<num> should be Comparable<int>. Uh, even stranger, Comparable seems to be non-generic: |
true, maybe it's a bug in subtype tests? Note: seems like you had a link to a very old revision, it was added this past week: CC'ng Gilad to get his opinion. cc @gbracha. |
I was confusing assignment compatibility with subtype tests. |
It is a problem. |
The problem is "solved" by changing the typing requirement on SplayTreeMap. Added Fixed label. |
I'm not sure what's the right fix for this. I want to use:
SplayTreeMap<int, X>
but I get an error in checked mode that 'int' is not a 'Comparable<int>' (currently SplayTreeMap expects 'K extends Comparable<K>')
I can work around this easily by using 'num' as the type of my keys, but I think there is something here that should be fixed. Either we want to make
'int' implements 'Compatable<int>', or relax the type constraint in SplayTreeMap, for instance to expect a K extends Comparable, but not necessarily Comparable<K>?
The text was updated successfully, but these errors were encountered: