Summary: | Enum switch statement compile error | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Adrian Grealish <agrealis> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | andrew.ferguson |
Version: | 3.2 | ||
Target Milestone: | 3.2 M4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Adrian Grealish
2005-07-29 13:33:05 EDT
I would say this is a bug in javac if I refer to jls 15.28 about the constant expression specifications: 15.28 Constant Expression ConstantExpression: Expression A compile-time constant expression is an expression denoting a value of primitive type or a String that does not complete abruptly and is composed using only the following: ... * Parenthesized expressions whose contained expression is a constant expression. ... So because NORMAL is a constant expression, (NORMAL) should also be a constant expression. If you remove the surrounding parenthesis, it works fine. Philippe, I would close as INVALID. I would agree with you Olivier. Please add a regression test, and close as invalid. Added org.eclipse.jdt.core.tests.compiler.regression.EnumTest.test122. Closing as INVALID. *** Bug 108675 has been marked as a duplicate of this bug. *** Reopening, pls see last comment Javac matching entryhttp://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6356542 We should reject parenthesized enum constants in switch. Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.compiler.regression.EnumTest.test122. Verified for 3.2 M4 using build I20051212-0010 |