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 08:54:09 +0200
Message-ID: <d3d1281d44e89ed904b245293a85e765@imap.procolix.com> (raw)
In-Reply-To: <003a01d0a869$3312b1c0$99381540$@eu>
References: <000c01d0a7b6$97571ee0$c6055ca0$@eu>
	<CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com>
	<CAH7T-ap2yMyiCEEajffqd863Dpnjag_LVvWPnP5PuARpbbJ1UA@mail.gmail.com>
	<003a01d0a869$3312b1c0$99381540$@eu>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On Tue, 16 Jun 2015 21:18:17 +0200, "Markus KARG" <markus@headcrashing.eu>
wrote:
> To make things a bit more clear: It is NOT about whether or not an
> interface method has a parameter of an unknown type. It is solely about
> whether that method is actually INVOKED at runtime. As a JDBC42 is
unknown
> to a JDBC3 client, that client CANNOT invoke that method, hence NEVER a
> ClassNotFoundException can ever happen. Actually the cause of the
exception
> is not even the method invocation but it is solely the instantiation of
the
> parameter value which happens IN THE CALLER. We're pretty safe I think.
So
> still I do not see any need for separate JARs for the purpose of serving
> multiple JDBC levels, as long as the byte code is Java 6 level.

When I tried it in the past (for Jaybird) I ran into problems, it might
have been an IncompatibleClassChangeError (or subclass) on classloading
time, but I can't remember the exact details. I tried reading the JLS and
JVM spec on this point, but I find it hard to come to a conclusion, so I
will try a small experiment this weekend.

However that is half of your problem. The other half is that you risk
using classes, methods or maybe even features that are not available in a
lower Java version and that will not be detected compile time, but only at
runtime (and not just in newly added JDBC 4.2 methods).

On top of that, for a compliant JDBC 4.2 implementation, you must support
java.time objects in setObject, getObject, updateObject, etc. If you want
to do this in a unified source, you will need to load a delegated
implementation that is appropriate for the Java version, otherwise you will
get ClassNotFoundException.

For example in Jaybird we did this:
https://github.com/FirebirdSQL/jaybird/blob/master/src/main/org/firebirdsql/jdbc/field/FBField.java#...

Which uses (for JDBC 4.2):
https://github.com/FirebirdSQL/jaybird/blob/master/src/jdbc_42/org/firebirdsql/jdbc/field/JDBC42Obje...

And for JDBC 4.1 (and 4.0 in Jaybird 2.2):
https://github.com/FirebirdSQL/jaybird/blob/master/src/main/org/firebirdsql/jdbc/field/DefaultObject...

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: <d3d1281d44e89ed904b245293a85e765@imap.procolix.com>
Permalink:  ../d3d1281d44e89ed904b245293a85e765@imap.procolix.com/
Also on:    postgresql.org/message-id/d3d1281d44e89ed904b245293a85e765@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: <d3d1281d44e89ed904b245293a85e765@imap.procolix.com>
  References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com> <CAH7T-ap2yMyiCEEajffqd863Dpnjag_LVvWPnP5PuARpbbJ1UA@mail.gmail.com> <003a01d0a869$3312b1c0$99381540$@eu> <d3d1281d44e89ed904b245293a85e765@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