Bug 80935 - problem with manually adding nested enum types
Summary: problem with manually adding nested enum types
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-14 10:26 EST by anuhertsa CLA
Modified: 2004-12-15 04:32 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 anuhertsa CLA 2004-12-14 10:26:14 EST
I have constructed the following class the demonstrate the problem:

import java.util.*;

public class Card {
  public enum Rank { DEUCE, THREE, FOUR, FIVE, SIX,
    SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }

  public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }

  private Card(int rank, int suit) {  
  }
  
  private static final List<Card> protoDeck = new ArrayList<Card>();
  
  public static ArrayList<Card> newDeck() {
      return new ArrayList<Card>(protoDeck); // Return copy of prototype deck
  }
}

When I create the file by copying the text into the Java editor everything
compiles. Then I comment out the line 'public enum Suit ..' etc; I enter exactly
the same line again by typing it; the result is that my class now has 2 compile
errors. 
The first one is in the declaration of 'Suit': it says 'Syntax error, insert
'Enumbody' to complete EnumDeclaration.
The second one is in the constructor of Card: it says 'Illegal modifier for the
enum constant Card: no modifier is allowed.
When I close the Java editor and open the Card class again, it contains no
compile errors anymore.

I'm using the final version of JDK 1.5 and Eclipse 3.1 M3.
Comment 1 Jerome Lanneluc CLA 2004-12-15 04:32:30 EST
Verified (in I20041214-2000) that you get no error after manully typing the enum
declaration.