Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5KF1-00024F-E9 for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Jun 2015 20:47:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z5KF0-0006ja-Ul for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Jun 2015 20:47:23 +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 1Z5KF0-0006jU-99 for pgsql-jdbc@postgresql.org; Wed, 17 Jun 2015 20:47:22 +0000 Received: from smtprelay02.ispgateway.de ([80.67.31.36]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z5KEw-0000Px-PL for pgsql-jdbc@postgresql.org; Wed, 17 Jun 2015 20:47:21 +0000 Received: from [88.66.14.101] (helo=Zauselmaus) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84) (envelope-from ) id 1Z5KEt-0001bw-HI for pgsql-jdbc@postgresql.org; Wed, 17 Jun 2015 22:47:15 +0200 From: "Markus KARG" To: "'List'" References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <823ac781b677cc2d56a111712d44f682@imap.procolix.com> <006801d0a86b$9cdf95d0$d69ec170$@eu> In-Reply-To: Subject: Re: Pre-processing during build Date: Wed, 17 Jun 2015 22:47:23 +0200 Organization: Markus KARG, Staatl. gepr. Inf. Message-ID: <002c01d0a93e$d00bb8c0$70232a40$@eu> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdCozbOtKN2VWr7/Qju9fNomdO7wTAAb74Rg Content-Language: de X-AVK-Virus-Check: AVA 25.1869;71FD75 X-AVK-Spam-Check: 1; str=0001.0A0C0202.5581DCD3.0112,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 Sorry but you're wrong here. Vladimir's example was invalid. See https://gist.github.com/mkarg/88a89ae0d= bffcfb7543e instead. Resolution will not fail. Even early static resolution won't. Check again t= he chapter of JLS about the critera to throw the listed exceptions. None of= them is met with the corrected example https://gist.github.com/mkarg/88a89= ae0dbffcfb7543e. The direct example will NOT fail on Java 7 as the method is not changed, bu= t added. The original method is still in place. Both methods exist at the s= ame time and differ by signature, hence the linker of the old program finds= the old method in the new class. No problem at all. The indirect example will NOT fail on Java 7 as a JRE 7 client will never p= ass in an instance of a JRE 8 type (how should even know of its existence?)= , and the Java 6 machine executing the invoked method will never INSTANTIAT= E that type so it will not fail. No problem at all. Still should work. You'd possibly like to set up a proof using the correcte= d example https://gist.github.com/mkarg/88a89ae0dbffcfb7543e. :-) Regards -Markus -----Original Message----- From: Mark Rotteveel [mailto:mark@lawinegevaar.nl]=20 Sent: Mittwoch, 17. Juni 2015 09:18 To: Markus KARG Subject: RE: [JDBC] Pre-processing during build On Tue, 16 Jun 2015 21:35:33 +0200, "Markus KARG" wrote: > On Mon, 15 Jun 2015 23:59:45 +0200, "Markus KARG" > wrote: >> For Java 6 and 7 it would be possible to use the same codebase (if you > ignore certain types iirc), but for Java 8 you need a separate library due > to the introduction of the SQLType interface. And if you fully support JDBC > 4.2, you also need the classes from java.time. >=20 > Actually I doubt that truely. The idea is NOT to support JDBC42 on Java 6. > The idea is that Java 6 loads our JAR and calls JDBC4 methods. The fact > that the same JAR also contains Java 8 types like java.time or the new > SQLType is invisible to the JRE 6 client application, as that one is > written against JDBC4, hence does neither INSTANTIATE that types NOR > invokes the methods using them as parameters! Vladimir already demonstrated one problem, at least when using reflection (which is not atypical with a lot of tools that use JDBC and with connections pools). And I already pointed at the resolution phase as described in the JLS that might happen at classloading time. >> JDBC APIs themselves are not backwards compatible (ie: they introduce new > types in the signature, or require you to handle new types in existing > methods), the API is only backwards compatible from the perspective of the > user. >=20 > I think that's pretty enough. Nobody forces is to use Oracle's JARs. The > driver just has to fulil the API towards the client application. That's why > it's called an API (not SPI). Can you please make an example what API is > incompatible between JDBC4 and JDBC42? An example of direct API incompatibility, use of a type new in Java 8 (SQLType): ResultSet.updateObject(int columnIndex, Object x, SQLType targetSqlType) http://docs.oracle.com/javase/8/docs/api/java/sql/ResultSet.html#updateObje= ct-int-java.lang.Object-java.sql.SQLType- An example of indirect API incompatibility: requirement to support java.time types (added in Java 8) in get/set/updateObject, although that can be worked around. Mark --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc