Bug 360317 - [compiler] report switch over enum in 1.4- mode
Summary: [compiler] report switch over enum in 1.4- mode
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: 3.8 M3   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 360164
Blocks:
  Show dependency tree
 
Reported: 2011-10-08 09:26 EDT by Stephan Herrmann CLA
Modified: 2011-10-24 04:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-10-08 09:26:53 EDT
The test case attached in bug 360164 comment 21 shows that if we allow 
resolving binary enum types even in 1.4- mode we would end up allowing 
switch over enum also below 1.5.

I believe the same was also true before bug 349326. Only with bug 349326
is the code currently rejected due to missing superclass Enum.

While it is technically possible to compile such code for a J2SE-1.4
this still looks wrong as we're accepting code that a 1.4 compiler could not.
Comment 1 Srikanth Sankaran CLA 2011-10-14 03:44:13 EDT
(In reply to comment #0)
> The test case attached in bug 360164 comment 21 shows that if we allow 
> resolving binary enum types even in 1.4- mode we would end up allowing 
> switch over enum also below 1.5.
> 
> I believe the same was also true before bug 349326

Yes, Just to be sure, I confirmed it with 3.6.2

> While it is technically possible to compile such code for a J2SE-1.4

What did you mean by that ? 

> this still looks wrong as we're accepting code that a 1.4 compiler could not.

Yes, I'll post a patch shortly at bug 360164
Comment 2 Stephan Herrmann CLA 2011-10-18 07:11:40 EDT
(In reply to comment #1)
> Yes, I'll post a patch shortly at bug 360164

The new message reads:

  Cannot switch on a value of type enum for source level below 1.5

Nit-picking: "enum" is not a type.

For comparison message 881 reads:

  Only convertible int values or enum variables are permitted

(why "variable"?)

How about:
  Cannot switch on an enum value for source level below 1.5
or 
  Cannot switch on a value of an enum type for source level below 1.5
?
Comment 3 Srikanth Sankaran CLA 2011-10-18 09:22:44 EDT
(In reply to comment #2)
> (In reply to comment #1)

> How about:
>   Cannot switch on an enum value for source level below 1.5
> or 
>   Cannot switch on a value of an enum type for source level below 1.5
> ?

Reconciling the above with bug 360164 comment 36, let us settle on:

Cannot switch on an enum value for source level below 1.5.  Only 
convertible int values are permitted
Comment 4 Stephan Herrmann CLA 2011-10-18 10:38:05 EDT
Released as commit 2d89f0516f5e5910bcd18015e8090ed0805dbb4e for 3.8 M3.
(combined patch with bug 360164).
Comment 5 Srikanth Sankaran CLA 2011-10-24 04:25:47 EDT
Verified for 3.8 M3 using build id: N20111022-2000.