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

Bug 348492

Summary: [1.7] Improve error msg on strings in switch in 1.5 mode
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, markus.kell.r, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:

Description Deepak Azad CLA 2011-06-06 23:40:31 EDT
In the following snippet with 1.5 the compiler does not say anything about using 1.7 level, while javac does. 

- I think this is needed for consistency, as for other 1.7 features the error message informs the user that the feature is available in source level 1.7 or greater.
- In JDT UI we can then provide a quick fix to change compiler compliance to 1.7 (see bug 348459)

-------------------------------------------------------------
    void foo(String s) {
        switch (s) {
        case "abc":
            System.out.println("abcd");
            break;
        case "xyz":
            System.out.println("xyz");
            break;
        }
    }
-------------------------------------------------------------
Comment 1 Deepak Azad CLA 2011-06-07 00:07:02 EDT
See also bug 348493.
Comment 2 Ayushman Jain CLA 2011-06-07 05:31:26 EDT
Fixed in BETA_JAVA7 branch
Comment 3 Srikanth Sankaran CLA 2011-06-28 05:03:54 EDT
Verified using "Eclipse Java Development Tools Patch for Java 7 Support (BETA)	1.0.0.v20110623-0900	org.eclipse.jdt.patch.feature.group	Eclipse.org"