dev@glassfish.java.net

Re: decision w.r.t. Java class version for GFv3-trunk sources ...

From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: Wed, 18 Feb 2009 08:32:27 -0800

Bill Shannon wrote:
> Rajiv Mordani wrote:
>> Hi Kedar,
>>
>> Kedar Mhaswade wrote:
>>> This is what we decided in the morning meeting.
>>>
>>> http://is.gd/jTnz
>>>
>>> Let me know if we are on the same page.
>>>
>>> Giving you a summary for convenience:
>>>
>>> Since by definition, Java EE 6 requires Java SE 6 runtime, it is
>>> obvious that we use Java 6 for compilation. Thus, the javac used for
>>> compilation of Java sources in GlassFish v3 trunk is /bin/javac (or
>>> its equivalent). Now, the target for such a build is Java 6 runtime.
>>> Thus, by default, i.e. if we don't specify the -target option on
>>> javac, the generated classes would have a Major Version of 50.0
>>> (which corresponds to Java 6). Thus, if we did that, all the modules
>>> will only create classes that can be loaded by Java 6 runtime. In
>>> order to support Java 5 runtime which might be required by some of
>>> the components (although their source are checked in to v3 trunk),
>>> here is the decision taken:
>>>
>>> 1. GlassFish v3 must be run with Java 6+ runtime only. (Can
>>> someone clarify if it applies to all the distro's?)
>>> 2. We use javac from Java 6 for compilation. Because of that, any
>>> module can declare compile-time dependencies on Java 6 classes, e.g.
>>> java.io.Console.
>>> 3. We use -target as 1.5 which means, by default, the major
>>> version of classes generated by build would be 49. This is to take
>>> care of running certain modules with Java 5 runtime.
>>
>> Do we know what the list of modules are that want to run with Java 5
>> runtime?
>>
>>> 4. asadmin will detect an attempt to run GlassFish with Java 5
>>> Runtime See: 7038 and will flag it as an error.
>>
>> If asadmin is not going to allow running GlassFish with Java 5 runtime
>> what's the point of making the target 1.5? Is the expectation that
>> some of these modules could be used outside of GlassFish and that in
>> such cases they may not want to move to JDK 6?
>
> Shouldn't we separate such modules from the rest of the GlassFish build
> and have them built on their own so they can be built using JDK 5?

Probably yes. I have maintained a list at: http://is.gd/jYI4.

Developers -- please help fill it.

An issue might arise when we want to build all of GFv3 including external
dependencies from source (read Ubuntu build). In that case, we might
need both Java 5, 6 in the PATH and I don't know how maven plugin can
take it into account. I think this is mostly handled by using JDK 6
javac and using -target as 1.5 for those modules.
>
> If some modules are going to be *designed* to work on JDK 5, they really
> should be built with JDK 5, to make sure no JDK 6 dependencies creep in.
> For example, that's what I'm doing with JavaMail.

The decision is largely based on some API not being available on JDK 5. In
that case you have to use JDK 6 for building anyway. But let's say I am not
using any of the new JDK 6 API (and the language changes from 5->6 are
none/small), must I be building using JDK 6 or is building with JDK 5
acceptable?