Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

understanding J2SE 5.0 Enum

 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm coming from the C# world where I can write an enumerated type like so:



...and then call it from another class like so, and it would work:



However, I get an error (Eclipse) telling me "QueryType.STORED_PROCEDURE cannot be resolved". Code-hinting reveals that I all have available to me from the QueryType type is "QueryType.class" and "QueryType.this"...both of which don't make any sense to me.

I'm expecting to be able to call the enum values in a static fashion but I can't!?

I have an import reference to it, that's not the problem...

Documentation on the net is dirt poor and I can't find one good solid example.

Can anyone help me out?

Thanks!
 
R�mi Forax
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an eclipse bug !

for now, eclipse (3.1M2) doesn't understand enum correctly.
 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've gotta be kidding me!?

Is there a fix yet? A newer version than M2 w/ an update to this problem?
 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, obviously eclipse has the same problem w/ "VarArgs"?

This should be correct yet eclipse is telling me it's a no-no.



Eclipse says:


Can only iterate over an array or an instance of java.lang.Iterable


According to the Java book I bought, this should work...
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is always a problem when using features that are new to the latest release of a language. The version of Eclipse you are using is compling your code with the 1.4 compiler and you are using 1.5 features. If you have Ant installed, you can get around this by writting a build script that defines which compiler to use and run the Ant script from Eclipse.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by R�mi Forax:
It's an eclipse bug !


Actually it's not a bug - it's work in progress.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic