Bug 108675 - built-in compiler accepts syntax outside the JLS?
Summary: built-in compiler accepts syntax outside the JLS?
Status: RESOLVED DUPLICATE of bug 105592
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 108701 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-02 10:23 EDT by Andrew Ferguson CLA
Modified: 2005-12-02 10:45 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Ferguson CLA 2005-09-02 10:23:08 EDT
hi,

 if you compile a switch statement on an enum type under javac, then it 
rejects code which compiles without error under the compiler built into 
eclipse.

javac does not accept enumeration constants in parentheses. the compiler built 
into eclipse does. An example is

enum Foo { A, B }

Foo foo = 1==1 ? A : B;
switch(foo) {
   case (A): System.out.println(" a "); break;
   case (B): System.out.println(" b "); break;
}

javac will complain about this, while the eclipse compiler won't. The Java 
Language Spec. appears to agree with javac from my understanding.

http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.11
Comment 1 Olivier Thomann CLA 2005-09-05 07:40:05 EDT
This is a known bug of javac.
(A) is a constant expression and therefore should be accepted.
Comment 2 Olivier Thomann CLA 2005-09-05 07:40:31 EDT
*** Bug 108701 has been marked as a duplicate of this bug. ***
Comment 3 Olivier Thomann CLA 2005-09-06 09:44:44 EDT

*** This bug has been marked as a duplicate of 105592 ***
Comment 4 Olivier Thomann CLA 2005-12-02 10:45:42 EST
This is indeed invalid.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6356542