| Summary: | A Foo class implementing Comparable<Foo> should be accepted as T in a generic declaration <T extends Comparable<? super T>> in all contexts. Even when the class is final. | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Hector Ciruelos <heciruel> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.8.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
| Attachments: | |||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Created attachment 235679 [details] Different classes compatible with "T extends Comparable<? super T>" are declared. Then they are used in a class comparison. First two comparisons are accepted by the compiler, but not so last two. The file attached, when compiled with Eclipse compiler, generates next two errors: * On line 32: Incompatible operand types Class<T> and Class<Dalmata> * On line 35: Incompatible operand types Class<T> and Class<Fruit> The behaviour appears when doing the Class comparison as indicated in the file. The most relevant thing is that the complain is raised only for "final" classes, as non-final ones Animal and Dog are accepted normally. As I am not an expert on JLS, I have just tried another compilers, and they seem to agree with my understanding that the code is legal. Thanks, Hector