• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Eclipse enum cannot be resolved

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am in a new job & working on a small project. We use Java 1.5, and I have been using Eclipse (v.3.2.0) as my IDE. For 3 weeks now, I've had no problems with the existing code compiling & running. The existing code contains several enum types - no problems. But now, someone checked in some changes to a file, including adding another enum type and it will not compile - I get the error "My_Component_States cannot be resolved."

Here's the code snippet - it is done just like the other enums in our project that compile with no problem, and I'm the only one having an issue with it (and the only one using Eclipse...)



Any ideas??
 
Gail Schlentz
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok - fixed the problem... I guess... I went into my preferences & found that somehow my "Compiler compliance level" got set back to 1.4 instead of 5.0.

But what I don't understand is 1) How it got reset, and 2) If it was throwing errors on one enum, why not all of them?? (Yes, I did do a complete clean & rebuild - multiple times!) Weird.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

why the compiler compliance level is changed to 1.4? if you are running your application in 1.5??

Please clarify me.

thanks,
Prasanna
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Eclipse compiler compliance level appears to have nothing to do with the version of the JDK you are using. But you can change it globally by going to Windows | Preference | Java | Compiler. Once you change it there any new projects you create will inherit that setting.
 
prasannakumar Reddy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Change your keyword name from enum to some thing else like enumr.... you should not change your compiler level to 1.4...
if your application working on java 1.5.

//prasanna
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Change your keyword name from enum to some thing else like enumr.


This is not correct advice. The keyword should remain as "enum". prasannakumar, I know that you are trying to help, but I think you are just causing confusion. Elaine's original question was why the compile compliance level was set incorrectly, which caused the enum keyword to be flagged. My earlier post provided a possible reason (the compliance level was set to 1.4 globally and was thus inherited by the project), and setting the level to 1.5 is the correct course of action.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem with it. and I don't think your advice doesn't work on ordinary problem, Peter Johnson. But it doesn't work at my case.

I'm using the eclipse on JDK 1.7.
but it's still on the way.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic