pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Rotteveel <mark@lawinegevaar.nl>
To: List <pgsql-jdbc@postgresql.org>
Subject: Re: Migration to Maven
Date: Thu, 26 Nov 2015 19:34:38 +0100
Message-ID: <565750BE.9090804@lawinegevaar.nl> (raw)
In-Reply-To: <CAE_9P=iEqvUbbuyedsSGVcFTxwgaSFz8Ux_qbn33Mk5E5tkrgw@mail.gmail.com>
References: <2138484843.20942254.1448530099460.JavaMail.zimbra@redhat.com>
	<2113338928.20942725.1448530160996.JavaMail.zimbra@redhat.com>
	<CADK3HHL5NDG65eVB6Ka5vnq4KdrJq7QPwwL9Gia83jiieCfbKA@mail.gmail.com>
	<CAE_9P=iEqvUbbuyedsSGVcFTxwgaSFz8Ux_qbn33Mk5E5tkrgw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On 26-11-2015 18:03, Adam Brightwell wrote:
 >> Our bigger problem is to figure out how to have JDK 1.6, 1.7, and 
1.8 and
 >> ... all supported by one codebase
 >
 > Isn't that what the '-source' and '-target' flags for javac are meant
 > to help solve?

That only helps if you are compiling the same software for different 
Java versions (and then it would suffice to just target Java 6, as Java 
6 bytecode can also be run on newer Java versions).

Also, if you use any new feature in the API, then compiling this way 
will lead to a false sense of security as a Java 7 compiler set to 
-source and -target 1.6 will **not** detect that you used new classes or 
methods (unless you explicitly specify a bootclasspath that points to 
the Java 6 runtime classes).

The main problem however is that Java 6 is JDBC 4.0, Java 7 JDBC 4.1 and 
Java 8 JDBC 4.2. Each new version added new methods and requirements. If 
I recall correctly it should be possible to compile JDBC 4.1 compliant 
code with Java 6 (there might be some edge cases), however JDBC 4.2 
added a number of new methods that take the SQLType interface, which was 
added in Java 8. On top of that, JDBC 4.2 compliance requires 
implementation of java.time support on get/setObject in 
PreparedStatement and ResultSet. Java.time was also introduced in Java 8.

This makes it impossible to compile the same code for Java 6 and Java 8. 
You need to do some form of preprocessing, or selecting/combining 
version dependent sourcetrees.

Mark
-- 
Mark Rotteveel


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (45+ messages)  latest in thread

Message-ID: <565750BE.9090804@lawinegevaar.nl>
Permalink:  ../565750BE.9090804@lawinegevaar.nl/
Also on:    postgresql.org/message-id/565750BE.9090804@lawinegevaar.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mark@lawinegevaar.nl
  Subject: Re: Migration to Maven
  In-Reply-To: <565750BE.9090804@lawinegevaar.nl>
  References: <2138484843.20942254.1448530099460.JavaMail.zimbra@redhat.com> <2113338928.20942725.1448530160996.JavaMail.zimbra@redhat.com> <CADK3HHL5NDG65eVB6Ka5vnq4KdrJq7QPwwL9Gia83jiieCfbKA@mail.gmail.com> <CAE_9P=iEqvUbbuyedsSGVcFTxwgaSFz8Ux_qbn33Mk5E5tkrgw@mail.gmail.com> <565750BE.9090804@lawinegevaar.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox