> > MyClass.java:5: generics are not supported in -source 1.4
> > (try -source 1.5 to enable generics)
> > static Vector<MyClass> v = new Vector<MyClass>();
>
> Why not try -source 1.5 -target 1.4?
Why don't you? :)
Quote: "javac: source release 1.5 requires target release 1.5"
You have to understand that Java isn't Perl - it's not interpreted. New
*language* features introduce new *opcodes* which a 1.4 JVM would
probably class as Invalid (look at ClassLoader/SecurityManager).
Javac obviously won't let you specify 'Generate these special 1.5
Opcodes, and then target them for a JVM that's never heard of them".
Cheers,
Ross

Signature
[Ross A. Bamford] [ross AT the.website.domain]
Roscopeco Open Tech ++ Open Source + Java + Apache + CMF
http://www.roscopec0.f9.co.uk/ + info@the.website.domain
Daniel Sjöblom - 29 Apr 2005 11:40 GMT
> You have to understand that Java isn't Perl - it's not interpreted. New
> *language* features introduce new *opcodes* which a 1.4 JVM would
> probably class as Invalid (look at ClassLoader/SecurityManager).
I'm not aware of any new opcodes being introduced in a long time. There
is one new variation on the ldc instruction in java 1.5, which however
does not do anything that couldn't be done before (it loads a class
literal.) It is however impossible to compile all 1.5 source to 1.4
bytecode. The most obvious problems are lack of an annotation
specification in the 1.4 class file format, and also the need for
generic signatures, also not present in 1.4.

Signature
Daniel Sjöblom
Remove _NOSPAM to reply by mail
Ross Bamford - 29 Apr 2005 13:00 GMT
On Fri, 2005-04-29 at 13:42 +0300, Daniel Sj=B6blom wrote:
> I'm not aware of any new opcodes being introduced in a long time.
Of course you're right - I said it without thinking, just to try to get
across why it doesn't work. The intent remains the same, that the core
JVM doesn't understand the class file structure.
Sorry for confusion :)

Signature
[Ross A. Bamford] [ross AT the.website.domain]
Roscopeco Open Tech ++ Open Source + Java + Apache + CMF
http://www.roscopec0.f9.co.uk/ + info@the.website.domain
Juha Laiho - 30 Apr 2005 18:44 GMT
Ross Bamford <ross@read.the.sig> said:
>You have to understand that Java isn't Perl - it's not interpreted.
Apologies for taking this completely off-topic, but just for the record,
Perl isn't interpreted, either - it's compiled into bytecode, but the
compilation results are not (normally) permanently stored. Instead,
there's a compilation phase each time you run a Perl program.
From documentation:
After locating your program, Perl compiles the entire program to an
internal form. If there are any compilation errors, execution of the
program is not attempted. (This is unlike the typical shell script,
which might run part-way through before finding a syntax error.)

Signature
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Tor Iver Wilhelmsen schreef:
>>MyClass.java:5: generics are not supported in -source 1.4
>>(try -source 1.5 to enable generics)
>> static Vector<MyClass> v = new Vector<MyClass>();
>
> Why not try -source 1.5 -target 1.4?
I use these paramaters, and it works fine. Maybe it doesn't work for all
1.5 extensions, but it works fine for generics.
Thomas Schodt - 07 May 2005 11:43 GMT
> I use these paramaters, and it works fine. Maybe it doesn't work for all
> 1.5 extensions, but it works fine for generics.
What does "javah -version" say?
[Or "javac -version" if javac now does -version].
Tony Morris - 07 May 2005 12:49 GMT
> Tor Iver Wilhelmsen schreef:
> >
[quoted text clipped - 6 lines]
> I use these paramaters, and it works fine. Maybe it doesn't work for all
> 1.5 extensions, but it works fine for generics.
No, you cannot use -source 1.5 -target 1.4.
You want to look at the undocumented compiler switch -jsr14.
If you are using source level 1.5, why are you using a data type
(java.util.Vector) that was obsoleted 7 or 8 years ago?
http://qa.jtiger.org/GetQAndA.action?qids=53

Signature
Tony Morris
Software Engineer, IBM Australia.
BInfTech, SCJP 1.4, SCJD
http://www.jtiger.org/ JTiger Unit Test Framework for Java
http://qa.jtiger.org/ Java Q&A (FAQ, Trivia)
http://xdweb.net/~dibblego/