You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Dy...@Sun.COM on 2007/10/02 14:29:43 UTC

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Rick Hillegas <Ri...@Sun.COM> writes:

> Please vote on whether we should require that developers use a Java 5
> (or later) compiler in order to build Derby. This means that the shell
> window running the build should have its JAVA_HOME pointed at a Java 5
> or later jdk and the corresponding javac should be what's visible on
> PATH. The practical implication of this change is that the Derby build
> will fail when run from a jdk1.4 environment.

+1

-- 
dt


Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Thomas Nielsen <Th...@Sun.COM>.
Dag H. Wanvik wrote:
> It seems -target jsr14 is not officially supported for the Sun JDK, at least it is not
> listed in the javac documentation as a valid target:
> 
> http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#options

True.

 From what I can tell -target jsr14 was introduced during generics 
development in 1.5 beta, and is not officially supported nor documented 
It still works though, but we probably shouldn't rely on it as it may 
probably change without notice.

--- snip ---
<5>derby/tests> javac -version
javac 1.5.0_12
...

<5>derby/tests> javac -source 1.5 -target jsr14 SqlStressTest.java
<5>derby/tests>
--- snip ---

This short article on the IBM site is actually a good writeup on this 
topic by a Suns Brian Goetz:
http://www.ibm.com/developerworks/java/library/j-jtp02277.html

To summarize: -target jsr14 gives you the following on a pre-java 5 JVM:
- generics
- autoboxing
- for-each loops (with some limitations)
- String concatenation using StringBuffer, not StringBuilder

If your interested in more details - please refer to the article. It has 
some additional information on Retroweaver and Retrotranslator as well.

Thomas
-- 
Thomas Nielsen

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Daniel John Debrunner <dj...@apache.org> writes:

> Never mind:
>
>> $JAVA_HOME/bin/javac -target 1.4 -source 1.5
> javac: source release 1.5 requires target release 1.5

It seems -target jsr14 is not officially supported for the Sun JDK, at least it is not
listed in the javac documentation as a valid target:

http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#options

(quote):

The versions supported by javac are:
1.1 	Generate class files that will run on VMs in JDK 1.1 and later.
1.2 	Generate class files that will run on VMs in JDK 1.2 and later, but will not run on 1.1 VMs.
1.3 	Generate class files that will run on VMs in JDK 1.3 and later, but will not run on 1.1 or 1.2 VMs.
1.4 	Generate class files that will run on VMs in JDK 1.4 and later, but will not run on 1.1, 1.2 or 1.3 VMs.
1.5 	Generate class files that are compatible only with JDK 5 VMs.
5 	Synonym for 1.5

Dag

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Daniel John Debrunner <dj...@apache.org>.
Daniel John Debrunner wrote:
> Thomas Nielsen wrote:
>> Daniel John Debrunner wrote:
>>> Seems that it might be possible with this to start using some 1.5 
>>> language constructs in Derby's code: those that compile down to 
>>> standard byte code. This would be by using -source 1.5 -target 1.4 in 
>>> the build.xml files.
>>
>> Be *very* careful about what 1.5 language features you start using in 
>> your code. It's not as easy as specifying -source 1.5 -target 1.4 to 
>> get a 1.4 compatible class/jar.
>>
>> If you end up using the "wrong" language constructs in your code, you 
>> will become dependant on additional libraries like Retrowaver (or 
>> similar) that implements the missing features/classes for you.
> 
> To be clear I explicitly meant Java language constructs (ie. JLS), not 
> 1.5 new methods or classes. As Bryan said if you could share your 
> experience that would be helpful.

Never mind:

 > $JAVA_HOME/bin/javac -target 1.4 -source 1.5
javac: source release 1.5 requires target release 1.5

Dan.

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Daniel John Debrunner <dj...@apache.org>.
Thomas Nielsen wrote:
> Daniel John Debrunner wrote:
>> Seems that it might be possible with this to start using some 1.5 
>> language constructs in Derby's code: those that compile down to 
>> standard byte code. This would be by using -source 1.5 -target 1.4 in 
>> the build.xml files.
> 
> Be *very* careful about what 1.5 language features you start using in 
> your code. It's not as easy as specifying -source 1.5 -target 1.4 to get 
> a 1.4 compatible class/jar.
> 
> If you end up using the "wrong" language constructs in your code, you 
> will become dependant on additional libraries like Retrowaver (or 
> similar) that implements the missing features/classes for you.

To be clear I explicitly meant Java language constructs (ie. JLS), not 
1.5 new methods or classes. As Bryan said if you could share your 
experience that would be helpful.

Dan.

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Bryan Pendleton <bp...@amberpoint.com>.
>> Seems that it might be possible with this to start using some 1.5 
>> language constructs in Derby's code: those that compile down to 
>> standard byte code. This would be by using -source 1.5 -target 1.4 in 
>> the build.xml files.
> 
> Be *very* careful about what 1.5 language features you start using in 
> your code. It's not as easy as specifying -source 1.5 -target 1.4 to get 
> a 1.4 compatible class/jar.
> 
> If you end up using the "wrong" language constructs in your code, you 
> will become dependant on additional libraries like Retrowaver (or 
> similar) that implements the missing features/classes for you.

Thanks Thomas! Existing experience here is very helpful.

Perhaps you could start a wiki page about this, and collect any
specific information that you recall from your prior experiences
of mixing and matching language features, and then as we figure out
additional conventions about what works, and what doesn't, we can
add them to the wiki page.

thanks,

bryan



Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Thomas Nielsen <Th...@Sun.COM>.
Daniel John Debrunner wrote:
> Seems that it might be possible with this to start using some 1.5 
> language constructs in Derby's code: those that compile down to standard 
> byte code. This would be by using -source 1.5 -target 1.4 in the 
> build.xml files.

Be *very* careful about what 1.5 language features you start using in 
your code. It's not as easy as specifying -source 1.5 -target 1.4 to get 
a 1.4 compatible class/jar.

If you end up using the "wrong" language constructs in your code, you 
will become dependant on additional libraries like Retrowaver (or 
similar) that implements the missing features/classes for you.

In a former life we ended up writing 1.4 code and compiled using a 1.5 
compiler to avoid additional dependencies.

"-target jsr14" seem to be supported now (it wasn't back then), and 
might solve this issue.

Thomas
-- 
Thomas Nielsen

Re: [VOTE] Require Java 5 (or later) compiler to build Derby

Posted by Daniel John Debrunner <dj...@apache.org>.
Rick Hillegas <Ri...@Sun.COM> writes:

>> Please vote on whether we should require that developers use a Java 5
>> (or later) compiler in order to build Derby. This means that the shell
>> window running the build should have its JAVA_HOME pointed at a Java 5
>> or later jdk and the corresponding javac should be what's visible on
>> PATH. The practical implication of this change is that the Derby build
>> will fail when run from a jdk1.4 environment.

+1

Seems that it might be possible with this to start using some 1.5 
language constructs in Derby's code: those that compile down to standard 
byte code. This would be by using -source 1.5 -target 1.4 in the 
build.xml files.

Examples are the for each loop, auto-boxing and some annotations. 
Something to try out anyway ...

Dan.