You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Peter Kriens <Pe...@aQute.biz> on 2007/10/09 11:35:32 UTC

Moving bnd to Java 5 ...

I want to move bnd to Java 5. Not only do I wan to take advantage of
the generics, I also really like the for loop but most of all the use
of printf feels so comfortable. I do not see a reason why our
development tools should stick to 1.4?

Any ideas?

Kind regards,

   Peter Kriens

-- 
Peter Kriens                              Tel +33467542167
9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
34160 Beaulieu, France                    ICQ 255570717
Skype pkriens                             Fax +1 8153772599
                     


Re: Moving bnd to Java 5 ...

Posted by Jeff McAffer <Je...@ca.ibm.com>.
Stefano Lenzi <ki...@interfree.it> wrote on 10/09/2007 03:30:56 PM:

> Also I would like to ask to the Eclipse expert how does Eclipse 
> implements Execution Environment, because in the properties of a Java 
> Project it's possible to define the Execution Environment both for 
> execution and compilation.

Not sure if I am "the Eclipse Expert" to which you refer but I'll take a 
stab.  Basically you define the BREE for your bundle and Eclipse tries to 
match that with the set of JREs available.  We analyze the JREs when they 
are configured into the IDE to see what EE they represent.  It is also 
possible to define and install "ee files" which describe JREs, the 
execution environemnt they provide and how to run them.  So for example, I 
have Foundation 1.0 and 1.1, J2SE 1.3, 1.4 and 1.5 JREs available.  The 
net effect is that the IDE compiles my projects against the actual JRE 
that was declared in the manifest.  The story is basically the same with 
PDE Build.

In some cases, for example if there isn't a JRE that exactly matches the 
BREE then we use the information Eclipse-provided "JRE profile" 
definitions and setup access rules on the compiler so you get errors if 
you reference packages you should not.  This does not catch references to 
extra methods or classes though.

The PDE Incubator API tools effort will be producing both shell JARs for 
various modules (eg JREs) as well as being able to post process modules to 
validate that they are adhering to their API dependency claims.

As for using Java 5, in general I would caution against assuming that 
tools are tools and only used at development time.  Especially things like 
BND which might plausibly used as part of some application that 
dyanmically creates/installs bundles from JARs etc (e.g., something that 
takes WARs and converts them to bundles at install time).  Retro-weaving 
is certainly an option.  For us we always ask if there is a pressing need 
for 1.5 function or real value in the language features to counter-act the 
retroweaving hassle and the API management issues associated with Java 5. 
Very much a personal/community choice thing.  Does BND have alot of API or 
code that would benefit from this change?

HTH
Jeff

Re: Moving bnd to Java 5 ...

Posted by Stefano Lenzi <ki...@interfree.it>.
Marcel Offermans wrote:
> On Oct 9, 2007, at 12:29 , Felix Meschberger wrote:
> 
>> One single problem remains, when having to compile for older platforms:
>> Even though the class file comes out as compatible, the class may refer
>> to classes/methods not available on the older platform. But this is for
>> this other thread discussing about the possibilities to compile using
>> one of the OSGi provided packages instead of the default rt.jar.
> 
> Exactly, we need to be able to specify execution environments as targets 
> for the Java compiler. In fact, we might even want to specifically be 
> able to target different execution environments simultaneously (but 
> that's another issue). [...]

I really think that is important to force maven to build Felix core 
artifacts using only a specific execution environment.

If I recall correctly we've already discussed it in some thread and we 
decided to use the org.osgi.foundation artifact as bootclasspath for the 
Java compiler. As far as I know none has tested it out.
My concern is on using the org.osgi.foundation artifact is that we 
should split the org.osgi.foundation into two artifact one for each 
execution environment defined by OSGi Allience in order to avoid the 
mixing among JavaSE and JavaME execution environment.

Also I would like to ask to the Eclipse expert how does Eclipse 
implements Execution Environment, because in the properties of a Java 
Project it's possible to define the Execution Environment both for 
execution and compilation.

> 
> Greetings, Marcel
> 
> 
> 


Re: Moving bnd to Java 5 ...

Posted by Marcel Offermans <ma...@luminis.nl>.
On Oct 9, 2007, at 12:29 , Felix Meschberger wrote:

> One single problem remains, when having to compile for older  
> platforms:
> Even though the class file comes out as compatible, the class may  
> refer
> to classes/methods not available on the older platform. But this is  
> for
> this other thread discussing about the possibilities to compile using
> one of the OSGi provided packages instead of the default rt.jar.

Exactly, we need to be able to specify execution environments as  
targets for the Java compiler. In fact, we might even want to  
specifically be able to target different execution environments  
simultaneously (but that's another issue). Having our toolchain be  
Java 5 does not really affect this issue (which is already present now).

Greetings, Marcel


Re: Moving bnd to Java 5 ...

Posted by Felix Meschberger <fm...@gmail.com>.
Am Dienstag, den 09.10.2007, 11:35 +0200 schrieb Peter Kriens:
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?

Neither do I. I agree with all the other entries to this thread.

One single problem remains, when having to compile for older platforms:
Even though the class file comes out as compatible, the class may refer
to classes/methods not available on the older platform. But this is for
this other thread discussing about the possibilities to compile using
one of the OSGi provided packages instead of the default rt.jar.

Regards
Felix


Re: Moving bnd to Java 5 ...

Posted by Paul Duffin <pd...@volantis.com>.
Peter,
     I thought that it already was Java 5, certainly I had to use 
retroweaver to run within our build which was Java 1.4 based. I have 
just started using Java 5 and the extra stuff is very nice. Generics are 
a little verbose but you save by reduced casting and even more with type 
safety.

Peter Kriens wrote:
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?
> 
> Any ideas?
> 
> Kind regards,
> 
>    Peter Kriens
> 

Re: Moving bnd to Java 5 ...

Posted by Marcel Offermans <ma...@luminis.nl>.
On Oct 9, 2007, at 11:35 , Peter Kriens wrote:

> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?

I agree, the development tools should not have to stick to 1.4 at  
all. Java 5 (or even 6) should be fine and might actually make life  
easier.

Greetings, Marcel


Re: Moving bnd to Java 5 ...

Posted by Stuart McCulloch <st...@jayway.net>.
On 09/10/2007, Peter Kriens <Pe...@aqute.biz> wrote:
>
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?


as Alin said, we can always retrotranslate it to run on 1.4 JDKs - I think
the benefits of using Java5 are worth it...

Any ideas?
>
> Kind regards,
>
>    Peter Kriens
>
> --
> Peter Kriens                              Tel +33467542167
> 9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
> 34160 Beaulieu, France                    ICQ 255570717
> Skype pkriens                             Fax +1 8153772599
>
>
>


-- 
Cheers, Stuart

Re: Moving bnd to Java 5 ...

Posted by Stefano Lenzi <ki...@interfree.it>.
Peter Kriens wrote:
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?
> 
> Any ideas?

I think it's reasonable to have development tools using Java 5 or more 
recent Java version, till the Felix artifacts do not require Java 5 or 
new bytecode.

Ciao,
Stefano "Kismet" Lenzi

> 
> Kind regards,
> 
>    Peter Kriens
> 


Re: Moving bnd to Java 5 ...

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Tuesday 09 October 2007 17:35, Peter Kriens wrote:
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?

Yeah, the only concern some folks may have (I'm in Java5-only shop) is the mix 
of JVM's required for development tools and target JVMs. I have no problems 
dealing with that.... any more, but used to be a pain (especially in 1.1.8, 
1.2, 1.2.2, 1.3.0 days with DOM1 and DOM2 transitioning as well! Phew!).


Cheers
-- 
Niclas Hedhman, Software Developer

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

Re: Moving bnd to Java 5 ...

Posted by Alin Dreghiciu <ad...@gmail.com>.
Peter,

Why not move to java 5, use all those things you like and then use the
retrotranslator to provide also a java 1.4 jar.
I do that in pax runner and works fine.

Alin

On 10/9/07, Peter Kriens <Pe...@aqute.biz> wrote:
> I want to move bnd to Java 5. Not only do I wan to take advantage of
> the generics, I also really like the for loop but most of all the use
> of printf feels so comfortable. I do not see a reason why our
> development tools should stick to 1.4?
>
> Any ideas?
>
> Kind regards,
>
>    Peter Kriens
>
> --
> Peter Kriens                              Tel +33467542167
> 9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
> 34160 Beaulieu, France                    ICQ 255570717
> Skype pkriens                             Fax +1 8153772599
>
>
>