Re: Pre-processing during build - Mailing list pgsql-jdbc

From Christopher BROWN
Subject Re: Pre-processing during build
Date
Msg-id CAHL_zcPBd95BujfmLVB1TY8gkS6m9PEmgL4oQNL9Kx5cpM1M1w@mail.gmail.com
Whole thread Raw
In response to Re: Pre-processing during build  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Responses Re: Pre-processing during build
List pgsql-jdbc
On 18 June 2015 at 14:38, Vladimir Sitnikov <sitnikov.vladimir@gmail.com> wrote:
>I see nothing wrong with implementing Driver using java.reflect.Proxy,

+1.

>PGDriver6 / PGDriver7 / PGDriver8 which could be compiled in steps

We can just compile all the drivers using JDK8 and -source 1.6 -target
1.6, can't we?
Well, step-by-step might be more robust, however it would require
careful setup of development environment (developers would have to
install different JDK versions and that is a high entry bar).

If you don't change the bootstrap classpath per driver, and you use the same JDK (8), then even with source/target set to 1.6, "javac" will complain that (for your pre-Java-8 drivers) you haven't implemented everything.  It does require installing versions of JDK 6, 7, and 8 and -- at least in Ant, haven't tried in Maven or Gradle -- you can define paths as build properties.  Furthermore, even if contributors find a simple workaround, the release manager would be able to be more confident about use (within implementations) of other JDK classes that may not be available on all target versions if at least s/he does have such a setup (read : it's not the end of the world if a contributor makes a mistake with the classpath, as long as any such mistakes are caught before a release is made).

Java 9 will use modules instead of the monolithic "rt.jar" so this is something that will need to be watched out for.

 

>I've not yet encountered any JVM that attempts to fully-resolve all signatures as soon as it loads a class.  Does such a JVM exist?

JLS allows JVM to load classes at any point in time, however if JVM
decides to do early loading, it should not throw exceptions before
application code indeed tries to touch the "bad method".

http://www.excelsiorjet.com/ is a JVM that compiles java down to
native code. I guess they do a lot of resolutions at compile phase
(much more than OpenJDK does).

Here's the relevant JLS section:
https://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.2.1
"... however, to reflect loading errors only at points in the program
where they could have arisen without prefetching or group loading"

Vladimir

pgsql-jdbc by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: Pre-processing during build
Next
From: Vladimir Sitnikov
Date:
Subject: Re: Pre-processing during build