Voici ma classe ConnectionState.java:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package framework.connectivity;
 
public enum ConnectionState
{
  static
  {
    CONNECTED = new ConnectionState("CONNECTED", 1);
    DISCONNECTED = new ConnectionState("DISCONNECTED", 2);
    ConnectionState[] arrayOfConnectionState = new ConnectionState[3];
    arrayOfConnectionState[0] = CONNECTING;
    arrayOfConnectionState[1] = CONNECTED;
    arrayOfConnectionState[2] = DISCONNECTED;
    $VALUES = arrayOfConnectionState;
  }
 
  private ConnectionState() {}
}
Même problème pour une autre classe enum
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static enum CommandType
  {
    static
    {
      EXECUTE = new CommandType("EXECUTE", 2);
      CommandType[] arrayOfCommandType = new CommandType[3];
      arrayOfCommandType[0] = READ;
      arrayOfCommandType[1] = WRITE;
      arrayOfCommandType[2] = EXECUTE;
      $VALUES = arrayOfCommandType;
    }
 
    private CommandType() {}
  }
Egalemet cette classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public enum EncryptionType
{
  static
  {
    AES128 = new EncryptionType("AES128", 1);
    AES256 = new EncryptionType("AES256", 2);
    EncryptionType[] arrayOfEncryptionType = new EncryptionType[3];
    arrayOfEncryptionType[0] = NONE;
    arrayOfEncryptionType[1] = AES128;
    arrayOfEncryptionType[2] = AES256;
    $VALUES = arrayOfEncryptionType;
  }
 
  private EncryptionType() {}
}
Comment écrire autrement, eclipse me renvoi plein d'erreurs?