Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 453798

Summary: Spurious "Incompatible operand types" for unknown type
Product: [Eclipse Project] JDT Reporter: Luke Hutchison <luke.hutch>
Component: CoreAssignee: 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:

Description Luke Hutchison CLA 2014-12-01 12:01:42 EST
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.
Comment 1 Jay Arthanareeswaran CLA 2014-12-02 00:03:01 EST
I am surprised the unresolved type error is not the primary error reported.

Shankha, see what can be done here.
Comment 2 Luke Hutchison CLA 2018-09-14 04:54:14 EDT
Obsolete, closing.