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

From Markus KARG
Subject Re: Pre-processing during build
Date
Msg-id 005d01d0a93f$aac42740$004c75c0$@eu
Whole thread Raw
In response to Re: Pre-processing during build  (Mark Rotteveel <mark@lawinegevaar.nl>)
List pgsql-jdbc
Well, there IS a difference: We can pack our own copy of java.sql.Type with our Driver, but we should not dare to do
thatwith non-java.sql.* types. Hence, if that is the only package, we're safe. No problem. 

This is a typical pattern used by several Java EE specifications. For example, JPA. If the JRE finds the class on the
bootstrapclasspath, it uses it. If not, it's using the one on the application classpath. Finely documented by the JVM
specification,BTW, and performed daily by Java EE specs. 

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Mark Rotteveel
Sent: Mittwoch, 17. Juni 2015 13:13
To: List
Subject: Re: [JDBC] Pre-processing during build

On Wed, 17 Jun 2015 06:15:47 -0400, Dave Cramer <pg@fastcrypt.com> wrote:
> On 17 June 2015 at 03:07, Mark Rotteveel <mark@lawinegevaar.nl> wrote:
>
>> On Wed, 17 Jun 2015 00:02:40 +0300, Vladimir Sitnikov
>> <sitnikov.vladimir@gmail.com> wrote:
>> > 2015-06-16 22:30 GMT+03:00 Markus KARG <markus@headcrashing.eu>:
>> >> 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.
>> >
>> > Markus, can you please be more explicit in your suggestion?
>> >
>> > I did try a simple "Hello, world" and it does not run in stock JDKs
of
>> > MacOS: https://gist.github.com/vlsi/aeeb4a61d9c2b67ad213
>> > Even if you manage to make that fly, that would be built on sand.
>>
>> Good example: it demonstrates at least that using reflection (eg
>> getDeclaredMethods; or in this case privateGetDeclaredMethods) will
lead
>> to
>> a NoClassDefFoundError.
>>
>>
> I'm not sure this is a great example as Optional itself is a java 8
> construct.

Yes, and so is java.sql.SQLType. So if this doesn't work for Optional, it
also won't work for SQLType.

> Either way Spring is able to do this, as are others?

Spring uses a lot of reflection, proxies, byte code generation, etc to get
things done. I am not sure if you want to go that way.

Mark


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



pgsql-jdbc by date:

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