pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus KARG <markus@headcrashing.eu>
To: 'List' <pgsql-jdbc@postgresql.org>
Subject: Re: Pre-processing during build
Date: Tue, 16 Jun 2015 21:26:12 +0200
Message-ID: <004b01d0a86a$4e9e6eb0$ebdb4c10$@eu> (raw)
In-Reply-To: <CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com>
References: <000c01d0a7b6$97571ee0$c6055ca0$@eu>
	<CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com>
	<CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Vladimir,

you misunderstood my proposal. I do not want to have multiple versions of the same class. I want ONLY JDBC42 API compiled down to Java 6 byte code in one single JAR. JDBC42 is backwards compatible to all older JDBC levels, and Java 7 and 8 can load Java 6 byte code.

Also the idea is NOT to allow Java 6 and 7 clients to INVOKE JDBC42 but just to load the JAR and invoke e. g. JDBC4 methods that are part of JDBC42 still (again, it's backwards compatible).

Regarding your example: A Java 7 client will never try to call that methods as Java 7 clients do not even know that such a method exist. Only Java 8 clients will know. That method is more than clearly marked as "since 1.8" so a Java 7 application programmer does not even KNOW about it pure existence!

So it boils down to verification and I doubt that the bytecode verifier will try to actually load java.sql.Type class. Have you really tried this out or do you have another link where it is written that the byte code verifier will CHECK the existence of a parameter class when it verifies the loaded class?

Regards
Markus

-----Original Message-----
From: Vladimir Sitnikov [mailto:sitnikov.vladimir@gmail.com] 
Sent: Dienstag, 16. Juni 2015 00:48
To: Dave Cramer
Cc: Markus KARG; List
Subject: Re: [JDBC] Pre-processing during build

Marcus,

>Has anybody tried whether it is possible to simply load a JRE8-JDBC42.jar on JRE6?

As you are a fan of JEPs, you might know of
http://openjdk.java.net/jeps/238 : Multi-Version JAR Files
It does not "just work" yet.

Suppose you want implement PreparedStatement(...java.sql.SQLType)
features of JDBC 4.2 (see [1]).
Even if you compile that with target 1.7, JRE 7 might fail to load the
class as it won't be able to validate what that SQLType is. It just
does not exist in JRE7.

As far as I understand, the only manageable way of using "new
features" in "JDK6-7 jars" is to isolate JDK8-using methods to
JDK8-only-loaded classes. For instance, PreparedStatement41.java and
PreparedStatement42.java

[1]: https://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html#setObject-int-java.lang.Ob...-

Vladimir



-- 
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: <004b01d0a86a$4e9e6eb0$ebdb4c10$@eu>
Permalink:  ../004b01d0a86a$4e9e6eb0$ebdb4c10$@eu/
Also on:    postgresql.org/message-id/004b01d0a86a$4e9e6eb0$ebdb4c10$@eu

 · 

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: markus@headcrashing.eu
  Subject: Re: Pre-processing during build
  In-Reply-To: <004b01d0a86a$4e9e6eb0$ebdb4c10$@eu>
  References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <CADK3HHK9TUug9amtabv1a+27u_bb31FCsLBarWsPv_PD12JCcw@mail.gmail.com> <CAB=Je-FC6NE7z=OMpfGRyOPk--Fw6Uci9iFbu+JQ1THfeuhgHA@mail.gmail.com> <004b01d0a86a$4e9e6eb0$ebdb4c10$@eu>

* 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