The myeclipse java project copied from someone else, opened it and saw a large number of red flags. After a closer look, it turned out that it did not recognize the enum keyword, which was a bit embarrassing.
I rebuilt a java project myself and tested it. If I choose JavaSE-1.6 when building a new project:
It recognizes the enum keyword, but if I choose the second or default jdk1.8, it won't work. Later I found that the maximum upper limit in the java compiler compliance level is only 1.7. Therefore, there are two solutions (the principle is the same). One is to set the compiler compliance level to above 1.5, and the other is to modify the org.eclipse.jdt.core under .settings to the following content:
eclipse.preferences.version=1org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabledorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserveorg.eclipse.jdt.core.compiler.compliance=1.6org.eclipse.jdt.core.compiler.debug.li neNumber=generateorg.eclipse.jdt.core.compiler.debug.localVariable=generateorg.eclipse.jdt.core.compiler.debug.sourceFile=generateorg.eclipse.jdt.core.compiler.problem.assertIdentifier=erroorg.eclipse.jdt.core.compiler.source=1.6
The above is a quick solution to the Java enum keyword not recognizing that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!