Bug 93583

Summary: [1.5][compiler] exhaustive enum switch not noticed
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Adam Kiezun CLA 2005-05-03 15:06:11 EDT
3.1M6

the method is marked as having an error. This is clearly bogus because the
switch is exhaustive. I don't know what the spec says though. (It'd be sad if it
enforced the error)

public class A {
	enum Kind {Foo, Bar, Baz}
	
	private Kind kind;
	String getName(){
		switch(kind){
		case Foo: return "Foo";
		case Bar: return "Bar";
		case Baz: return "Baz";
		}
	}
}
Comment 1 Philipe Mulet CLA 2005-05-09 07:28:17 EDT
Nice idea but remember that due to binary compatibility, one may add an enum
constant, not recompile client code, and suddenly one could traverse the entire
switch.

Javac agrees with us.