Re: What is <E>?
"Redbeard" <tom.cowdery@bigfoot.com> wrote in message
news:1152154753.821964.63370@75g2000cwc.googlegroups.com...
grasp06110 wrote:
One of my applets was specifically written to Java 1.1 standards to
avoid the need for the plug-in. Is this going to break now that 1.5 is
out?
I have been told that Java 1.5 byte code will run in older version of
the JVM. Not sure of the details beyond that.
John
I'm not worried about that, as much as I'm worried about my existing
Java 1.1 bytecode running in the 1.5 JVM which apparently doesn't have
the older version of the Vector class. I wrote the applet several
years ago when IE came with its own JVM. The applet is educational,
and many schools are still using out-of-date hardware with older
operating systems like Win98, and the older browsers that come with
them. Of course, there are also some, like mine, that have up-to-date
hardware and software. So I also need the applet to work on those
machines too.
IE's JVM is a special case, because it doesn't actually implement the
Java Standard. Basically, if you use MSJVM, all bets are off.
So ignoring MSJVM for now, 1.1 code should, for the most part, work with
1.5. In particular, if you don't use generics, your code will still run
fine. The generics information is only for compile time checking, and that
information doesn't even appear in the class files (google for Java Type
Erasure for more details).
The only thing is you'll get warnings with a 1.5 compiler. They're
trying to encourage you to use generics. But you can ignore those warnings
(or disable them completely).
FWIW, it appears that the older version would be Vector<Object> in the
new system. Maybe Vector and Vector<Object> are treated as the same
thing by the JVM.
There was a discussion a while ago; not sure if it's this newsgroup or
comp.lang.java.programmer, but the conclusion was that Vector, Vector<?> and
Vector<Object> are not exactly interchangeable, in some obscure corner
cases. If you want to use the "old" Vector, just use Vector (without any
type qualifiers), and live with the warning until you understand generics
better. It's better than putting in the wrong type qualifier and then
getting strange compile errors that you can't untangle.
- Oliver