JDK 1.5: keyword 'enum' is STUPID !!!!

What could the "brains" at SUN possibly be thinking.?

I mean really, in jdk1.4 source (1.4.0_01) I found 51 occurrences in 30 files of "Enumeration enum = ..."

So like them I have a lot of that in my code too. Now if I want to compile with jdk 1.5 I have to either user -source 1.4 option, or go through and change every occurrence of "enum". Sure I can write a script to transform most of these, but give me a break, why should ALL of us have to go through that.

If you look at the jdk1.5 source in files that used to contain "Enumeration eum =" you'll now see s**t like "Enumeration enum_ = ".

Come on, they could have choosen a different keyword. And as a side gripe: what genius came up with the 1.5, 5.0 deal? Shouldn't you have at least just called it 2.0 and go from there?

Ok. Go ahead, let me have it.

[850 byte] By [hunangardena] at [2007-10-1 1:00:35]
# 1
that's what you get when you add keywords.And it's going to get worse, if you look at the java.net forums people are clamoring to add more keywords and even operators to the language at an alarming rate.
jwentinga at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 2
2 new keywords in 9 years isn't bad given all the new language features in 1.5.0...-Alexis
am74686a at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 3

yeah, but this particular keyword is used all over the place as a variable name. Its everywhere. If you do a Google search for "Enumeration enum =" you'll see what I mean.

So look, fine make a new keyword, but do a Google search first to find out how much pain you will cause people that need to compile old code with the new jdk.

By the way, does anybody have a regular expression or script to find all occurrences of "enum" and change it to "enumer" or something?

hunangardena at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 4
> 2 new keywords in 9 years isn't bad given all the new> language features in 1.5.0...> -Alexistrue, but it's got the punters started who now want everything to be a keyword more or less...
jwentinga at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 5
Don't know about punters, butassertdidn't have the same effect...-Alexis
am74686a at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 6

> Don't know about punters, but

> assert

> didn't have the same effect...

> -Alexis

it did. There were quite a few people who had written their own assertion code and used assert in that as a variable and/or method name.

All that code broke if it were compiled with 1.4 unless 1.3 compatibility was selected.

jUnit for example had a major rewrite, renaming a lot of methods.

jwentinga at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 7
I agree that enum is a stupid name for a keyword.In this case, and I hope someone who has pull at Sun reads this:You guys got Java right the first time - so abide by this very simple rule:If it aint broke don't fix it.
seanbeecrofta at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 8
no offense, but in the time you spent complaining, you could have finished the find/replace by now. it can't be THAT bad.this is why everyone should use hungarian notation (just kidding, please don't throw anything at me)
wbrackena at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 9

> I agree that enum is a stupid name for a keyword.

> In this case, and I hope someone who has pull at Sun

> reads this:

>

> You guys got Java right the first time - so abide by

> this very simple rule:

>

>If it aint broke don't fix it.

Problem is that a lot of punters seem to think that the lack of their pet wannahave in Java is a critical problem and they're screaming very loudly to have them all added as keywords...

P.S. In our application (500+ classes) there was exactly 1 instance of the word 'enum' so your situation is not exactly something everyone encounters :)

jwentinga at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 10

Well, to be perfectly honest, I think "enum" is much more appropriate as a language keyword than as an object identifier in your own code. To me, the code...

Enumeration enum = ...

...is just plain lazy. Why not try using object names that actually *describe* what's contained in the enumeration? For example...

Enumeration customers = ...

Or you could view this as an opportunity to catch up with the current state-of-the-art in Java development. Officially, the Sun API docs (at least since the 1.3 JDK) say "New implementations should consider using Iterator in preference to Enumeration." You could change all of your code to something like...

Iterator iter = ...

...and just pray that Sun doesn't make "iter" a keyword.

Or you could just use meaningful identifiers to begin with. LOL

--BenjiSmith

BenjiSmitha at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...
# 11

>

> Iterator iter = ...

>

> ...and just pray that Sun doesn't make "iter" a

> keyword.

>

> Or you could just use meaningful identifiers to begin

> with. LOL

>

I usually use Iterator i = ... ;)

Of course using the new for/Each loop construct you no longer need to explicitly declare the Iterator :)

jwentinga at 2007-7-8 1:19:38 > top of Java-index,Administration Tools,Sun Connection...