They let the Tiger out

Thanks for the info, although one of the threads quoted in the link has been deleted now :(. Saves me wondering and hoping pointlessly :).

It’s a bit sad though - they are rather throwing the baby out with the bathwater. I can almost guarantee that this means we (and there must be many more like us) can’t use any of the 1.5 features for at least 3 years now, even where technically it’s obvious that we can and should. (nb: 3 years is about how long it takes both for the JVM to become stable (going by previous releases) and (inclusive) for most users (including those with OS’s which Sun doesn’t provide a JVM for) to get upgraded).

Thank **** that beanshell supports most of the anti-boilerplate features for all JVM’s back to 1.1 (makes Sun’s strategy here look especially wonky :frowning: ). It’s not a universal solution, but in some places it’s going to save as much as a man year for us (and I’m sure there are plenty of other developers who would make similar savings).

[quote]There has been lots of discussion of this in the generics forum.The new for loop and enum stuff require extensions to the existing libraries — in the case of the for loop, many classes now implement the Iterable interface. Autoboxing also requires some extra support.
So while generics largely doesn’t require a new JVM other details also added in 1.5 require updated libraries.
[/quote]
I appreciate it’s more than just a compiler issue, but supplying an alternative rt.jar isn’t really an issue, not even politically AFAICS, since you can easily get Sun’s own 1.4 (or earlier) rt.jar to compile against. The only real issue I can see is that of support - it would make reproducability of bugs considerably harder for Sun, which is certainly a good reason to not allow this.

In summary IMHO: that’s a fine strategy for when Sun was only making major changes. Now that they’ve started adding syntactic sugaring, it’s considerably harder to defend - simply because of people’s expectations; java developers aren’t stupid: they can tell when a major time-saving feature can be back ported with ease (especially when a free java add-on has already been doing it for a year!).

There’s some serious problems with upgrade and migration paths here, and I can see this issue resurfacing again and again for different people (bet Sun gets fed up of answering the question :)). It seems almost selfish of Sun to tout these extra features which so obviously could be used on any JVM, but not to allow people with old JVM’s to use them. Personally I wouldn’t mind if it weren’t that no Sun JVM has ever been stable enough for all production code until at least 18 months after release.

One possibility for those that know what they are doing is a byte code post processor. Then, provided you avoided those aspects of the new features that require additional support you could use the new compiler and then modify the byte code to allow it to run on an earlier JVM. This should be feasible if it is the generics which you want (bar the reflection extensions). The vararg stuff should also work.

It is also open for someone else to create a compiler which does allow targetting earlier versions while using some of the enhancements (and flagging those which can’t be supported). However, Sun’s Java compiler division (AKA Neil Gafter) doesn’t have the resources to do this. IBM perhaps …

Toby Reyelts has just posted this:

Yes! Yes, they do! ;D. Thanks for the followup, I hadn’t noticed Toby’s posting.

I get an “Invalid Source Release: 1.5”

when I compile with -source 1.5
Do i have to fix a classpath issue?

At a guess, it’s finding the wrong JDK in your path. Do you have a previous release also installed on the box?

Run “java -version” and see what it reports.

[quote]At a guess, it’s finding the wrong JDK in your path. Do you have a previous release also installed on the box?

Run “java -version” and see what it reports.
[/quote]
…and, on linux, “which javac” (tells you which directory it’s using to find a javac executable)