Re: Pre-processing during build

From: "Markus KARG" <markus(at)headcrashing(dot)eu>
To: "'List'" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Pre-processing during build
Date: 2015-06-17 20:36:42
Message-ID: 002901d0a93d$52152100$f63f6300$@eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

You got fooled by the fact that there is a difference between loading the very initial main class at JVM bootstrap, and loading ANY OTHER subsequent class. This is difference is clearly documented in chapters JLS 12.1 (initial class) and JLS 12.2 (other classes).

After correcting your example it works pretty well, see: https://gist.github.com/mkarg/88a89ae0dbffcfb7543e

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

On Wed, 17 Jun 2015 00:02:40 +0300, Vladimir Sitnikov
<sitnikov(dot)vladimir(at)gmail(dot)com> wrote:
> 2015-06-16 22:30 GMT+03:00 Markus KARG <markus(at)headcrashing(dot)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.

Mark

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Stephen Nelson 2015-06-17 20:43:13 Re: Pre-processing during build
Previous Message Markus KARG 2015-06-17 20:09:09 Re: Pre-processing during build