Yet Another '1.x on 1.4' question... but wait! This one's different!

So, after faithfully using Jikes (Best. Compiler. Ever. RIP) for many years, I've decided I'm too far behind the times, and I've moving back to javac for 1.5 and 1.6.

However, the applications I'm writing must have the biggest reasonable userbase (usually in situations where the users are unable to upgrade their JVM), which is 1.4 given the classes I use.

I've read some of the other threads about 1.5 on 1.4, but I'm still not clear. It seems to me that there are some 1.5 constructs that can be represented perfectly in 1.4 (for example, the newfor could be represented as a standard(for Iterator i = thing.iterator; i.hasNext(); ). I'd appreciate it if someone could give me simple answers to the following before I start rewriting a bajillion lines of code.

For these, I guess I'm asking not 'can it run on 1.4?', but 'will it run on 1.4?' - that is, will it be transparent and supported? Or is it a case of 'it might run... unless there're sunspots that day.'

a) Generics. Surely this is just sugar, and can be compiled into something 1.4-friendly?

b) Enhanced for. Again, I can't see why this would need a change in the bytecode.

c) Autoboxing. Again, more sugar.

d) Typesafe Enums. Ah... I think this might be a problem. I can't see a trivial way of representing this in 1.4.

e) Varargs. Nope. I think this'll require new bytecode.

f) Static imports. Again, 1.5 bytecode only?

g) Annotations. I'm going to pretend I know what these are, and scoff at the obviousness of the answer to this question. Pah!

So I think if I stick to Generics, the enhanced for, and Autoboxing, my code should work on 1.4. Does that make sense?

Or should I just bit the bullet, use all the new features, and rely on the Retro-* applications to cross-compile?

Any thoughts or advice gladly received.

Addendum : Jikes, why'd you have to die? Why?

[1957 byte] By [CodeMonkey9358a] at [2007-11-27 8:37:19]
# 1

> So I think if I stick to Generics, the enhanced for,

> and Autoboxing, my code should work on 1.4. Does that

> make sense?

>

No. You won't get it to compile, let alone run, to 1.4 classfile format.

> Or should I just bit the bullet, use all the new

> features, and rely on the Retro-* applications to

> cross-compile?

>

No, either use 1.4 or use 1.5, don't try to do both.

If you're desparate to use 1.5 but your users are on 1.4, try to educate them about the need to upgrade.

jwentinga at 2007-7-12 20:34:35 > top of Java-index,Developer Tools,Java Compiler...
# 2

> If you're desparate to use 1.5 but your users are on

> 1.4, try to educate them about the need to upgrade.

Thanks for the advice.

I think that's the best course of action. The new language features are very nice, and hopefully I won't have to beat my users too hard to get them to upgrade.

Ta!

CodeMonkey9358a at 2007-7-12 20:34:35 > top of Java-index,Developer Tools,Java Compiler...
# 3

> I think that's the best course of action. The new

> language features are very nice, and hopefully I

> won't have to beat my users too hard to get them to

> upgrade.

When java 1.7 is released 1.4 will enter the end of life process.

See 1.7 https://jdk7.dev.java.net/

See end of life process http://java.sun.com/products/archive/eol.policy.html

Once the EOL is completed Sun will no longer provide any updates (unless someone wants to pay Sun to do so.) Thus for example this years daylight savings changes would not have been supported (just as they are not supported in 1.3.)

The longer they wait the less time they will have to verify that all of their existing infrastructure will work with the newer version.

jschella at 2007-7-12 20:34:35 > top of Java-index,Developer Tools,Java Compiler...
# 4
in fact this year's DST changes are supported in 1.3 as the update in which they're implemented came just prior to the EOL process being completed :)But otherwise you're correct.
jwentinga at 2007-7-12 20:34:35 > top of Java-index,Developer Tools,Java Compiler...
# 5
> in fact this year's DST changes are supported in 1.3> as the update in which they're implemented came just> prior to the EOL process being completed :)Interesting.
jschella at 2007-7-12 20:34:35 > top of Java-index,Developer Tools,Java Compiler...