Bug 93583 - [1.5][compiler] exhaustive enum switch not noticed
Summary: [1.5][compiler] exhaustive enum switch not noticed
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-03 15:06 EDT by Adam Kiezun CLA
Modified: 2005-05-09 07:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.