Re: Pre-processing during build

Поиск
Список
Период
Сортировка
От Mark Rotteveel
Тема Re: Pre-processing during build
Дата
Msg-id 6682dee0335b1b04284ec1a060684d1a@imap.procolix.com
обсуждение исходный текст
Ответ на Re: Pre-processing during build  ("Markus KARG" <markus@headcrashing.eu>)
Ответы Re: Pre-processing during build  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Список pgsql-jdbc
On Thu, 18 Jun 2015 18:53:49 +0200, "Markus KARG" <markus@headcrashing.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


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Mark Rotteveel
Дата:
Сообщение: Re: Pre-processing during build
Следующее
От: "Markus KARG"
Дата:
Сообщение: Re: [pgjdbc] chore: migrate the build to Maven (#322)