| Summary: | Spurious "Incompatible operand types" for unknown type | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Luke Hutchison <luke.hutch> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED INVALID | QA Contact: | Jay Arthanareeswaran <jarthana> |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, shankhba, stephan.herrmann |
| Version: | 4.5 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I am surprised the unresolved type error is not the primary error reported. Shankha, see what can be done here. Obsolete, closing. |
Given the following code: static void test(Class<? extends DataModel> myModel) { if (myModel != DBModel.class) { // ... } } If DataModel has been imported but DBModel has not been imported, then all of "myModel != DBModel.class" is underlined in red, and if the user mouses over "myModel", they see the error "Incompatible operand types Class<capture#5-of ? extends DataModel> and Class<DBModel>". The true error "DBModel cannot be resolved to a type" is masked. That second error only shows if the user mouses over "DBModel.class" or the red X in the margin. The incompatible operand types error should not show if there is an unknown type, it masks the real error, which is that the user needs to import the unknown type. If the part before "!=" is much longer, it can be difficult to see what is really going on, because there is no indicator that the squiggly red line actually underlines two different errors, one overlapping with a subspan of the other.