Re: Pre-processing during build

From: Mark Rotteveel <mark(at)lawinegevaar(dot)nl>
To: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Pre-processing during build
Date: 2015-06-19 06:48:45
Message-ID: 6682dee0335b1b04284ec1a060684d1a@imap.procolix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 18 Jun 2015 18:53:49 +0200, "Markus KARG" <markus(at)headcrashing(dot)eu>
wrote:
> Regarding your questions and just for couriosity, even being irrelevant
> due to the reflection topic meanwhile: My example also fails even
without
> (!) reflection once you remove the inner class and simply have the Java
8
> method implemented directly by the main class. Hence it proofs the
special
> restriction for main classes. That restriction is the difference between
> 12.1 (= how an initial class is loaded) and 12.2 (= how other classes
are
> loaded). It is an optional implementation choice of the Oracle JVM to do
> so: It demands that ALL references from main class to other classes MUST
> have existing byte code. This demand does not exists for classes NOT
> directly references but loaded lazily at a later time (following 12.2
rules
> ONLY but not 12.1 rules). Just change my example and you'll see the
effect
> - it fails immediately as soon as there is no wrapping inner class
anymore
> decoupling the missing classes from the main class.

JLS 12.1 is defined in terms of the normal class loading and
initialization that is described in later sections. They even say "We now
outline the steps the Java Virtual Machine may take to execute Test, as an
example of the loading, linking, and initialization processes that are
described further in later sections.". The only difference I see is section
12.1.4: invoking the main method. If you see other difference I'd like you
to point them out.

If you look at the stacktrace when method is directly in the main class,
you'll notice that the JVM itself uses reflection to obtain and execute the
main method. And that use of reflection is what causes it to fail
immediately as opposed to the case with a separate class.

Mark

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Markus Karg 2015-06-20 09:40:50 How to change the PostgreSQL JDBC Driver Online Documentation?
Previous Message Mark Rotteveel 2015-06-19 06:37:13 Re: Pre-processing during build