Using generics ea 2.4

I've managed to get things working with ea2.4.

I had to add the run time classes from gjc-rt.jar to collect.jar to make them available to the runtime (collect.jar is now just for compiling against).

I also had to give add "-target jsr14" to the compiler command line to force it to generate 1.4 compatible classes (with -target 1.4, it signals an error, but carries on compiling regardless).

5 comments
Comment actions Permalink

I have updated the Generics FAQ.

http://www.intellij.org/twiki/bin/view/Main/GenericsFAQ

BTW Thanks for figure it out. I am putting back generics in my plugins!

0
Comment actions Permalink

Just out of interest:

Using the J2SDK1.5 is not enough for generics support?

Do I have to enable the generics support flag as well as using the 1.5 SDK ?

At the moment, I have test projects using the 1.5 compiler, and IDEA seems to be ok with List foo = new ArrayList]]>();
so that seems to be working ok.

Does the "Enable Generics Support" add additional things?


One last question which Im currently looking into:
Can I compile with 1.5 but make the compiled class files runnable on a 1.4.x JVM?

Nick

0
Comment actions Permalink

Definitely FAQ worthy - I ended up reading the compiler source to find the right args :) it would be cool if jetbrains could add this to the JSR14 checker. I'll see if there are any relevant bugs to vote for.

ea 2.2 was driving me crazy - though trying to debug something that's generating generics source, using the beta Apple JDK, under pre-beta pallada is probably grounds for comittal in the first place.

Simon

0
Comment actions Permalink

Using the J2SDK1.5 is not enough for generics support?
It should but since I haven't done anything with 1.5 I don't know. Do you compile externally or through IDEA?
Another thing to remember is the editor parsing and the compilation are 2 different things. IDEA editor hightlighting might be fine with generics but compilation might not.

Can I compile with 1.5 but make the compiled class files runnable on a 1.4.x JVM?
Right now you can with '-source 1.5 target 1.4'. However '-target 1.4' will be removed when 1.5 is released for legal reason (See http://forum.java.sun.com/thread.jsp?forum=316&thread=503547)
You will have to revert to bytecode manipulation tool that convert a 1.5 class file into a 1.4 compatible one. http://retroweaver.sf.net is such a tool (See http://www.theserverside.com/news/thread.tss?thread_id=24452#113921)

Jacques

0
Comment actions Permalink

-source 1.5 -target 1.4 signals an error with ea 2.4 (even though it keeps on compiling).

Under pallada that means that pallada won't automatically compile and run your code, since the compiler tells it an error occured

That's why they added -target jsr14 ; the code that checks for source/target mismatches doesn't complain if a target name is valid and doesn't start with a digit.

0

Please sign in to leave a comment.