| Summary: | [1.7] Compiler warning for invalid type inside switch needs to be improved | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ayushman Jain <amj87.iitr> | ||||
| Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | CC: | deepakazad, srikanth_sankaran | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 193778 [details]
proposed fix
Fixes the error message for 1.7 and above
Released in BETA_JAVA7 branch. (In reply to comment #0) > Cannot switch on a value of type {0}. Only convertible int values or enum > constants are permitted. New error is "Cannot switch on a value of type {0}. Only convertible int values, strings or enum constants are permitted" 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" |
BETA_JAVA7 Currently for an invalid type inside a switch statement, we warn Cannot switch on a value of type {0}. Only convertible int values or enum constants are permitted. From 1.7 onwards however, strings are permitted too, so the warning for 1.7 should reflect that. public class Try { void f(Object a) { final String xyzz = ""; switch (a){ // error here case xyzz: break; } } }