Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not compile enums in Eclipse

While trying to introduce enums in my Android project in Eclipse, I encountered with the following problem: Compiler says:

  1. The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files
  2. The type Enum is not generic; it cannot be parameterized with arguments

I work under Ubuntu 10.04 and use Eclipse v.3.5.2. Tried to use both Java 6 OpenJDK and Java 6 Sun, but without success.

Can anybody help me to sort out with this issue?

Here is the code:

public class MyClass {

  public MyClass() {
  }

  ...

  enum MyEnum {
    CONST1, CONST2, CONST3;
  }
}
like image 831
Artem Avatar asked Sep 28 '10 08:09

Artem


1 Answers

Open the properties for the project, select the page "Java Compiler" and set the "Compiler Compliance level" to "1.5" or better.

Project properties page for the Java Compiler

like image 104
Aaron Digulla Avatar answered Sep 29 '22 06:09

Aaron Digulla