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: Pre-processing during build
Date: Wed, 17 Jun 2015 14:01:49 +0200
Message-ID: <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com> (raw)
In-Reply-To: <2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com>
References: <000c01d0a7b6$97571ee0$c6055ca0$@eu>
	<CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com>
	<CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com>
	<CADK3HHJo=bjA9z=ZBzk-vqxfu+0Eh4UmLd0WJUhngKAVYogz8w@mail.gmail.com>
	<005101d0a86a$f18ffe90$d4affbb0$@eu>
	<CAB=Je-G1+7x4LabgB6A4cF_RY0CV1RwbDryFXa0GioB_vg7o=g@mail.gmail.com>
	<60b20bb834cf54db8232239b9c27fcc2@imap.procolix.com>
	<CADK3HHLmYp34yxQzjEuGgsUW4+joghHZf+0FBr44K8i5hXA+BA@mail.gmail.com>
	<ba57c14862b915a79a69de9089df736e@imap.procolix.com>
	<CAB=Je-HbMx0+s_cuMk68P8v9EymT4UM18Y0aJKqnZCiivABfYw@mail.gmail.com>
	<2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On Wed, 17 Jun 2015 13:52:52 +0200, Mark Rotteveel <mark@lawinegevaar.nl>
wrote:
> That is almost what PostgreSQL uses now, but this is not going to work
if
> you compile with Java 8 and assume that
> org.postgresql.jdbc4.PreparedStatement would then also be new-able when
the
> same jar is used under Java 6 or 7, because
> org.postgresql.jdbc4.PreparedStatement would need to be abstract at
compile
> time as it doesn't contain the methods required by the Java 8 (JDBC 4.2)
> API during compilation.
> 
> So getting this to work would need some form of reflection (to get the
> right type at runtime based on the Java version), some preprocessing (as
> done currently) to get around the compilation problem or some byte code
> generation/modification to "unabstract"
> org.postgresql.jdbc4.PreparedStatement after compilation, or some form
of
> tiered compilation (where the org.postgresql.jdbc4.PreparedStatement is
> compiled with Java 7, and org.postgresql.jdbc42.PreparedStatement with
Java
> 8; this might be more complex than the existing solution.

I just realized it might actually work: some (maybe all) methods added in
the JDBC API for Java 8 were added as default interface methods (with an
implementation that throws UnsupportedOperationException), so compilation
would succeed for org.postgresql.jdbc4.PreparedStatement without having an
implementation for the new methods.

You'd still need reflection or an other trick to decide based on the Java
version which classes (Statement, PreparedStatement, ResultSet, etc) to
instantiate.

Mark


-- 
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 (92+ messages)  latest in thread

Message-ID: <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com>
Permalink:  ../5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com/
Also on:    postgresql.org/message-id/5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com

 · 

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: Pre-processing during build
  In-Reply-To: <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com>
  References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com> <CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com> <CADK3HHJo=bjA9z=ZBzk-vqxfu+0Eh4UmLd0WJUhngKAVYogz8w@mail.gmail.com> <005101d0a86a$f18ffe90$d4affbb0$@eu> <CAB=Je-G1+7x4LabgB6A4cF_RY0CV1RwbDryFXa0GioB_vg7o=g@mail.gmail.com> <60b20bb834cf54db8232239b9c27fcc2@imap.procolix.com> <CADK3HHLmYp34yxQzjEuGgsUW4+joghHZf+0FBr44K8i5hXA+BA@mail.gmail.com> <ba57c14862b915a79a69de9089df736e@imap.procolix.com> <CAB=Je-HbMx0+s_cuMk68P8v9EymT4UM18Y0aJKqnZCiivABfYw@mail.gmail.com> <2e15428aa0cf241e6cd9b951ba96140b@imap.procolix.com> <5d539d76f4ccb9a59abc57d5d99c4d92@imap.procolix.com>

* 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