Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4wUv-0001yp-Mv for pgsql-jdbc@arkaria.postgresql.org; Tue, 16 Jun 2015 19:26:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z4wUu-00054O-Ud for pgsql-jdbc@arkaria.postgresql.org; Tue, 16 Jun 2015 19:26:12 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z4wUu-00054G-6b for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 19:26:12 +0000 Received: from smtprelay05.ispgateway.de ([80.67.31.99]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z4wUr-0004Dc-2Q for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 19:26:10 +0000 Received: from [88.66.7.101] (helo=Zauselmaus) by smtprelay05.ispgateway.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1Z4wUo-0007Ta-Bt for pgsql-jdbc@postgresql.org; Tue, 16 Jun 2015 21:26:06 +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:26:12 +0200 Organization: Markus KARG, Staatl. gepr. Inf. Message-ID: <004b01d0a86a$4e9e6eb0$ebdb4c10$@eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Content-Language: de Thread-Index: AdCnvUygt3PI7zh6TjSkTwZeyKyLYQAq/xPA X-AVK-Virus-Check: AVA 25.1869;71FD75 X-AVK-Spam-Check: 1; str=0001.0A0C0201.5580784D.01D0,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 Vladimir, you misunderstood my proposal. I do not want to have multiple versions of t= he 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, an= d 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 jus= t to load the JAR and invoke e. g. JDBC4 methods that are part of JDBC42 st= ill (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 c= lients 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 wil= l 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]=20 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.h= tml#setObject-int-java.lang.Object-java.sql.SQLType- Vladimir --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc