Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wZK-0002Ep-Be for pgsql-jdbc@arkaria.postgresql.org; Tue, 16 Jun 2015 19:30:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z4wZJ-0005nc-8Z for pgsql-jdbc@arkaria.postgresql.org; Tue, 16 Jun 2015 19:30:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z4wZI-0005nM-Gl for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 19:30:44 +0000 Received: from smtprelay01.ispgateway.de ([80.67.31.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z4wZE-0006Ud-HI for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 19:30:43 +0000 Received: from [88.66.7.101] (helo=Zauselmaus) by smtprelay01.ispgateway.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1Z4wZD-0001oe-3g for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 21:30:39 +0200 From: "Markus KARG" To: "'List'" References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> In-Reply-To: Subject: Re: Pre-processing during build Date: Tue, 16 Jun 2015 21:30:46 +0200 Organization: Markus KARG, Staatl. gepr. Inf. Message-ID: <005101d0a86a$f18ffe90$d4affbb0$@eu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0052_01D0A87B.B518CE90" X-Mailer: Microsoft Office Outlook 12.0 Content-Language: de Thread-Index: AdCnvkBpis6/xShMR9K/wOZtFCPa6gArGZHg X-AVK-Virus-Check: AVA 25.1869;71FD75 X-AVK-Spam-Check: 1; str=0001.0A0C0201.5580795F.0059,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0; F1206 X-Df-Sender: bWFya3VzQGhlYWRjcmFzaGluZy5ldQ== X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. ------=_NextPart_000_0052_01D0A87B.B518CE90 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The answer is pretty simple: Try it out. :-) =20 Just compile a JRE 8 class down to byte code level 6 and load it on Java = level 7. That's what I proposed. Nothing else. It really bet will work = unless you try to INSTANTIATE JRE-only classes, but it should LOAD. And = nothing more we need. =20 From: davecramer@gmail.com [mailto:davecramer@gmail.com] On Behalf Of = Dave Cramer Sent: Dienstag, 16. Juni 2015 00:54 To: Vladimir Sitnikov Cc: Markus KARG; List Subject: Re: [JDBC] Pre-processing during build =20 I'm wondering if we use the latest JRE to compile but target 1.7 will it = use the latest JDBC API, but compile to 1.7 bytecode. Apparently = https://github.com/brettwooldridge/HikariCP uses this method; and they = have a similar problem Dave Cramer dave.cramer(at)credativ(dot)ca http://www.credativ.ca =20 On 15 June 2015 at 18:47, Vladimir Sitnikov = wrote: 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.Object-java.sql.SQLType- Vladimir =20 ------=_NextPart_000_0052_01D0A87B.B518CE90 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

The answer is pretty simple: Try it out. :-)

 

Just compile a JRE 8 class down to byte code level 6 and load it on = Java level 7. That's what I proposed. Nothing else. It really bet will = work unless you try to INSTANTIATE JRE-only classes, but it should LOAD. = And nothing more we need.

 

From:= = davecramer@gmail.com [mailto:davecramer@gmail.com] On Behalf Of = Dave Cramer
Sent: Dienstag, 16. Juni 2015 = 00:54
To: Vladimir Sitnikov
Cc: Markus KARG; = List
Subject: Re: [JDBC] Pre-processing during = build

 

I'm = wondering if we use the latest JRE to compile but target 1.7 will it use = the latest JDBC API, but compile to 1.7 bytecode. Apparently https://github.com/b= rettwooldridge/HikariCP uses this method; and they have a similar = problem


Dave = Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

 

On 15 = June 2015 at 18:47, Vladimir Sitnikov <sitnikov.vladimir@gmail.com> = wrote:

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/Prep= aredStatement.html#setObject-int-java.lang.Object-java.sql.SQLType-
Vladimir

 

------=_NextPart_000_0052_01D0A87B.B518CE90--