Bug 17104

Summary: Compiler does not complain but "Quick Fix" ??? complains
Product: [Eclipse Project] JDT Reporter: Silenio Quarti <Silenio_Quarti>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: PC   
OS: other   
Whiteboard:

Description Silenio Quarti CLA 2002-05-22 17:47:16 EDT
Import the classes below and you will see that "SwitchTest"
has no compiler errors, but it has a "light icon" in the
line "case OS.CONST: return;" with the following tooltip text:

    "Type mismatch: cannot convert from int to short"

public class OS {
	public static final int CONST = 23 * 1024;
}
public class SwitchTest {
	public short c;	
	public static void main(String[] arguments) {
		short c = 1;
		switch (c) {
			case OS.CONST: return;
		}
	}
}
Comment 1 Martin Aeschlimann CLA 2002-05-30 06:01:43 EDT

*** This bug has been marked as a duplicate of 18175 ***
Comment 2 David Audel CLA 2002-06-05 10:54:09 EDT
This isn't a duplicate of 18175. Moving to JDT/Core for fixing
Comment 3 Philipe Mulet CLA 2002-06-05 11:13:54 EDT
Until field constants are part of the JavaModel, we have to live with this bug, 
since the compiler is only authorizing type mismatch if the constant is 
representable into the target type.

Deferring
Comment 4 Philipe Mulet CLA 2002-09-18 07:37:49 EDT
We want to address this for 2.1, by persisting field initialization source 
inside the model, for further usage - in particular for temp problems while 
reconciling.
Comment 5 Philipe Mulet CLA 2002-09-18 07:38:31 EDT
2.1-M2 candidate
Comment 6 Philipe Mulet CLA 2002-09-30 06:21:02 EDT
*** Bug 23382 has been marked as a duplicate of this bug. ***
Comment 7 Jerome Lanneluc CLA 2002-10-08 10:38:08 EDT
Changed Java model to persist the initialization source. Added flag on 
SourceTypeConverter to compute the AST from the initialization source if 
needed. Changed CompilationUnitProblemFinder to use this flag.
Comment 8 David Audel CLA 2002-10-17 10:10:48 EDT
Verified.