cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject [Important]: JDK issues
Date Mon, 24 Jun 2002 11:10:32 GMT
Hi,

during my testing of the protected sample I found some interesting 
aspects of choosing the JDK for compiling/running Cocoon that some 
of you might not know:

Question:
If Cocoon compiles with JDK 1.3 and JDK 1.4 without any problems, does
this mean that a version compiled with JDK 1.4 also runs with JDK 1.3?

Answer:
No (!) - At first, I was a little bit surprised by this, as Cocoon compiles
with both versions, so Cocoon does not use any method of JDK 1.4 which
is not in JDK 1.3. So it should be compatible!

But exactly the above statement is wrong. Let's have a look at an example:

<CODE>

StringBuffer a = new StringBuffer("a");
StringBuffer b = new StringBuffer("b");

a.append(b);

</CODE>

Now, JDK 1.3 has only a method "append( Object )" whereas JDK 1.4 offers
a new method "append( StringBuffer )".

So, if you compile the above with JDK 1.4 a reference to the method
"append( StringBuffer )" is in the compiled code. And when you run it with
JDK 1.3 you get a NoSuchMethodException.
But of course, the above compiles with JDK 1.3 as well, as the method
"append( Object )" is used then. And this works with JDK 1.3 and JDK 1.4
as well.

That's nice, isn't it?

So, I learn from this that the JDK used for compilation should be the
same used for running Cocoon. If you follow this rule, nothing bad could
happen...

...but what about all the other projects we use (Avalon, FOP, Batik, Xalan,
Xerces - to name only a few)? With which version are they compiled? Do
they use code like the one above?

I would really like to know if Sun has an answer on this one! 

Or did I miss something?

Carsten 

Carsten Ziegeler     Chief Architect     Open Source Group, S&N AG
------------------------------------------------------------------
             Cocoon Consulting, Training and Projects
------------------------------------------------------------------
mailto:cziegeler@s-und-n.de                  http://www.s-und-n.de
                    http://ziegeler.bei.t-online.de


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message