Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z57En-0001e5-H0 for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Jun 2015 06:54:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z57Em-0004qE-Q0 for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Jun 2015 06:54:16 +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 1Z57El-0004q7-R7 for pgsql-jdbc@postgresql.org; Wed, 17 Jun 2015 06:54:15 +0000 Received: from smtp.procolix.com ([95.215.185.30]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z57Ei-0000oa-Tq for pgsql-jdbc@postgresql.org; Wed, 17 Jun 2015 06:54:14 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.procolix.com (Postfix) with ESMTP id 9485543C8D for ; Wed, 17 Jun 2015 08:54:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at smtp.procolix.com Received: from smtp.procolix.com ([127.0.0.1]) by localhost (host436.procolix.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DPIF8TZdK-9i for ; Wed, 17 Jun 2015 08:54:09 +0200 (CEST) Received: from webmail.procolix.com (webmail.procolix.com [95.215.185.106]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mark@lawinegevaar.nl) by smtp.procolix.com (Postfix) with ESMTPSA id D449143A8F for ; Wed, 17 Jun 2015 08:54:09 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: Wed, 17 Jun 2015 08:54:09 +0200 From: Mark Rotteveel To: List Subject: Re: Pre-processing during build In-Reply-To: <003a01d0a869$3312b1c0$99381540$@eu> References: <000c01d0a7b6$97571ee0$c6055ca0$@eu> <003a01d0a869$3312b1c0$99381540$@eu> Message-ID: X-Sender: mark@lawinegevaar.nl User-Agent: RoundCube Webmail/0.2 X-Pg-Spam-Score: -1.9 (-) 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 On Tue, 16 Jun 2015 21:18:17 +0200, "Markus KARG" 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#L739 Which uses (for JDBC 4.2): https://github.com/FirebirdSQL/jaybird/blob/master/src/jdbc_42/org/firebirdsql/jdbc/field/JDBC42ObjectConverter.java 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/DefaultObjectConverter.java Mark -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc