You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Boris Heithecker <bo...@gmx.net> on 2019/10/12 06:49:44 UTC

NetBeans 11.1 with Java 11 fails to read package annotations

Hi all,
it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
jdk11.0.4) doesn't read annotations at package level properly. If I'm not
mistaken for whatever reason this is a really nasty bug.

Please have a look at this to reproduce:

https://github.com/borisheithecker/packagelevelannotationtest

If I run this small platform application with platform 11.1 and Java 11
selected, it fails (i.e. the package annotation is not found at runtime).
If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
expected.

I started porting a platform application yesterday which has been run on
8.2 so far and which makes heavy use of JAXB and Web Services. I spend the
whole day digging various sources on why the application fails to run on
Java 11 (with Metro JAX WS RI added as external library) until I found out
what seems to be the obvious reason now: it fails because JAXB can't
read @XmlSchema-annotations in package-info. Am I doing something wrong?

Boris

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Geertjan Wielenga <ge...@apache.org>.
On Sat, Oct 12, 2019 at 9:45 AM Boris Heithecker <bo...@gmx.net>
wrote:


> It fails even if I switch to JDK 11 and NetBeans 8.2.
>

NetBeans 8.2 does not support JDK 11.

Gj



> Boris
>
> Geertjan Wielenga <ge...@apache.org> schrieb am Sa., 12. Okt. 2019,
> 09:14:
>
> > So first start by using the same JDK for both to see whether it is a JDK
> > problem (probably since JDK 11 is very different to JDK 8) or not.
> >
> > Gj
> >
> > On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <boris.heithecker@gmx.net
> >
> > wrote:
> >
> >> Hi all,
> >> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
> >> jdk11.0.4) doesn't read annotations at package level properly. If I'm
> not
> >> mistaken for whatever reason this is a really nasty bug.
> >>
> >> Please have a look at this to reproduce:
> >>
> >> https://github.com/borisheithecker/packagelevelannotationtest
> >>
> >> If I run this small platform application with platform 11.1 and Java 11
> >> selected, it fails (i.e. the package annotation is not found at
> runtime).
> >> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
> >> expected.
> >>
> >> I started porting a platform application yesterday which has been run on
> >> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend
> the
> >> whole day digging various sources on why the application fails to run on
> >> Java 11 (with Metro JAX WS RI added as external library) until I found
> out
> >> what seems to be the obvious reason now: it fails because JAXB can't
> >> read @XmlSchema-annotations in package-info. Am I doing something wrong?
> >>
> >> Boris
> >>
> >
>

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Boris Heithecker <bo...@gmx.net>.
Filed an issue
https://issues.apache.org/jira/browse/NETBEANS-3234

On Sat, 12 Oct 2019 at 11:12, Boris Heithecker <bo...@gmx.net>
wrote:

> So if I'm not taken completely wrong, the reason is that
> neither org.netbeans.JarClassLoader nor org.netbeans.ProxyClassLoader nor
> org.netbeans.StandardModule$OneModuleClassLoader (all in
> platform/o.n.bootstrap) override "protected Class<?> findClass(String name)
> throws ClassNotFoundException" in java.lang.ClassLoader. Therefore, package
> classes aren't loaded.
> Boris
>
>
> On Sat, 12 Oct 2019 at 10:27, Boris Heithecker <bo...@gmx.net>
> wrote:
>
>> I got a little closer to the problem now.
>> So, take this line and debug it a) in plain Java 11, and b) in this
>> NetBeans platform (any version but running on JDK 11):
>>
>> java.lang.Package p = Main.class.getPackage();
>>
>> Class java.lang.Package in Java 11 differs in many aspects from Java 8.
>> In Java 11, it has a private field called "packageInfo" of type "Class<?>",
>> which in cases
>>
>> a) (the working case) is a reference to the actual package-info class
>> object, i.e. MyPackage.package-info
>>
>> b) always references "java.lang.Package$1PackageInfoProxy", i.e. the
>> java.lang.Package class object (and therefore NOT the class object
>> resulting from the compilation of e.g. MyPackage.package-info.java as it
>> would be supposed).
>>
>> This is a bug. It's most likely a NetBeans classloader issue.
>>
>> Boris
>>
>> On Sat, 12 Oct 2019 at 09:44, Boris Heithecker <bo...@gmx.net>
>> wrote:
>>
>>> It's definitely not a JDK problem. The code works fine in a non-platform
>>> application with jdk11.0.4. It's a problem of the combination JDK 11 plus
>>> NetBeans Platform. It fails even if I switch to JDK 11 and NetBeans 8.2.
>>> Boris
>>>
>>> Geertjan Wielenga <ge...@apache.org> schrieb am Sa., 12. Okt. 2019,
>>> 09:14:
>>>
>>>> So first start by using the same JDK for both to see whether it is a
>>>> JDK problem (probably since JDK 11 is very different to JDK 8) or not.
>>>>
>>>> Gj
>>>>
>>>> On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <
>>>> boris.heithecker@gmx.net> wrote:
>>>>
>>>>> Hi all,
>>>>> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
>>>>> jdk11.0.4) doesn't read annotations at package level properly. If I'm
>>>>> not
>>>>> mistaken for whatever reason this is a really nasty bug.
>>>>>
>>>>> Please have a look at this to reproduce:
>>>>>
>>>>> https://github.com/borisheithecker/packagelevelannotationtest
>>>>>
>>>>> If I run this small platform application with platform 11.1 and Java 11
>>>>> selected, it fails (i.e. the package annotation is not found at
>>>>> runtime).
>>>>> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
>>>>> expected.
>>>>>
>>>>> I started porting a platform application yesterday which has been run
>>>>> on
>>>>> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend
>>>>> the
>>>>> whole day digging various sources on why the application fails to run
>>>>> on
>>>>> Java 11 (with Metro JAX WS RI added as external library) until I found
>>>>> out
>>>>> what seems to be the obvious reason now: it fails because JAXB can't
>>>>> read @XmlSchema-annotations in package-info. Am I doing something
>>>>> wrong?
>>>>>
>>>>> Boris
>>>>>
>>>>
>>
>> --
>> Boris Heithecker
>>
>>
>> Dr. Boris Heithecker
>> Lüneburger Str. 30
>> 28870 Ottersberg
>> Festnetz: +49 4205 315834
>> Mobil: +49 170 6137015
>>
>
>
> --
> Boris Heithecker
>
>
> Dr. Boris Heithecker
> Lüneburger Str. 30
> 28870 Ottersberg
> Festnetz: +49 4205 315834
> Mobil: +49 170 6137015
>


-- 
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Festnetz: +49 4205 315834
Mobil: +49 170 6137015

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Boris Heithecker <bo...@gmx.net>.
So if I'm not taken completely wrong, the reason is that
neither org.netbeans.JarClassLoader nor org.netbeans.ProxyClassLoader nor
org.netbeans.StandardModule$OneModuleClassLoader (all in
platform/o.n.bootstrap) override "protected Class<?> findClass(String name)
throws ClassNotFoundException" in java.lang.ClassLoader. Therefore, package
classes aren't loaded.
Boris


On Sat, 12 Oct 2019 at 10:27, Boris Heithecker <bo...@gmx.net>
wrote:

> I got a little closer to the problem now.
> So, take this line and debug it a) in plain Java 11, and b) in this
> NetBeans platform (any version but running on JDK 11):
>
> java.lang.Package p = Main.class.getPackage();
>
> Class java.lang.Package in Java 11 differs in many aspects from Java 8. In
> Java 11, it has a private field called "packageInfo" of type "Class<?>",
> which in cases
>
> a) (the working case) is a reference to the actual package-info class
> object, i.e. MyPackage.package-info
>
> b) always references "java.lang.Package$1PackageInfoProxy", i.e. the
> java.lang.Package class object (and therefore NOT the class object
> resulting from the compilation of e.g. MyPackage.package-info.java as it
> would be supposed).
>
> This is a bug. It's most likely a NetBeans classloader issue.
>
> Boris
>
> On Sat, 12 Oct 2019 at 09:44, Boris Heithecker <bo...@gmx.net>
> wrote:
>
>> It's definitely not a JDK problem. The code works fine in a non-platform
>> application with jdk11.0.4. It's a problem of the combination JDK 11 plus
>> NetBeans Platform. It fails even if I switch to JDK 11 and NetBeans 8.2.
>> Boris
>>
>> Geertjan Wielenga <ge...@apache.org> schrieb am Sa., 12. Okt. 2019,
>> 09:14:
>>
>>> So first start by using the same JDK for both to see whether it is a JDK
>>> problem (probably since JDK 11 is very different to JDK 8) or not.
>>>
>>> Gj
>>>
>>> On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <bo...@gmx.net>
>>> wrote:
>>>
>>>> Hi all,
>>>> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
>>>> jdk11.0.4) doesn't read annotations at package level properly. If I'm
>>>> not
>>>> mistaken for whatever reason this is a really nasty bug.
>>>>
>>>> Please have a look at this to reproduce:
>>>>
>>>> https://github.com/borisheithecker/packagelevelannotationtest
>>>>
>>>> If I run this small platform application with platform 11.1 and Java 11
>>>> selected, it fails (i.e. the package annotation is not found at
>>>> runtime).
>>>> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
>>>> expected.
>>>>
>>>> I started porting a platform application yesterday which has been run on
>>>> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend
>>>> the
>>>> whole day digging various sources on why the application fails to run on
>>>> Java 11 (with Metro JAX WS RI added as external library) until I found
>>>> out
>>>> what seems to be the obvious reason now: it fails because JAXB can't
>>>> read @XmlSchema-annotations in package-info. Am I doing something wrong?
>>>>
>>>> Boris
>>>>
>>>
>
> --
> Boris Heithecker
>
>
> Dr. Boris Heithecker
> Lüneburger Str. 30
> 28870 Ottersberg
> Festnetz: +49 4205 315834
> Mobil: +49 170 6137015
>


-- 
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Festnetz: +49 4205 315834
Mobil: +49 170 6137015

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Boris Heithecker <bo...@gmx.net>.
I got a little closer to the problem now.
So, take this line and debug it a) in plain Java 11, and b) in this
NetBeans platform (any version but running on JDK 11):

java.lang.Package p = Main.class.getPackage();

Class java.lang.Package in Java 11 differs in many aspects from Java 8. In
Java 11, it has a private field called "packageInfo" of type "Class<?>",
which in cases

a) (the working case) is a reference to the actual package-info class
object, i.e. MyPackage.package-info

b) always references "java.lang.Package$1PackageInfoProxy", i.e. the
java.lang.Package class object (and therefore NOT the class object
resulting from the compilation of e.g. MyPackage.package-info.java as it
would be supposed).

This is a bug. It's most likely a NetBeans classloader issue.

Boris

On Sat, 12 Oct 2019 at 09:44, Boris Heithecker <bo...@gmx.net>
wrote:

> It's definitely not a JDK problem. The code works fine in a non-platform
> application with jdk11.0.4. It's a problem of the combination JDK 11 plus
> NetBeans Platform. It fails even if I switch to JDK 11 and NetBeans 8.2.
> Boris
>
> Geertjan Wielenga <ge...@apache.org> schrieb am Sa., 12. Okt. 2019,
> 09:14:
>
>> So first start by using the same JDK for both to see whether it is a JDK
>> problem (probably since JDK 11 is very different to JDK 8) or not.
>>
>> Gj
>>
>> On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <bo...@gmx.net>
>> wrote:
>>
>>> Hi all,
>>> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
>>> jdk11.0.4) doesn't read annotations at package level properly. If I'm not
>>> mistaken for whatever reason this is a really nasty bug.
>>>
>>> Please have a look at this to reproduce:
>>>
>>> https://github.com/borisheithecker/packagelevelannotationtest
>>>
>>> If I run this small platform application with platform 11.1 and Java 11
>>> selected, it fails (i.e. the package annotation is not found at runtime).
>>> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
>>> expected.
>>>
>>> I started porting a platform application yesterday which has been run on
>>> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend
>>> the
>>> whole day digging various sources on why the application fails to run on
>>> Java 11 (with Metro JAX WS RI added as external library) until I found
>>> out
>>> what seems to be the obvious reason now: it fails because JAXB can't
>>> read @XmlSchema-annotations in package-info. Am I doing something wrong?
>>>
>>> Boris
>>>
>>

-- 
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Festnetz: +49 4205 315834
Mobil: +49 170 6137015

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Boris Heithecker <bo...@gmx.net>.
It's definitely not a JDK problem. The code works fine in a non-platform
application with jdk11.0.4. It's a problem of the combination JDK 11 plus
NetBeans Platform. It fails even if I switch to JDK 11 and NetBeans 8.2.
Boris

Geertjan Wielenga <ge...@apache.org> schrieb am Sa., 12. Okt. 2019,
09:14:

> So first start by using the same JDK for both to see whether it is a JDK
> problem (probably since JDK 11 is very different to JDK 8) or not.
>
> Gj
>
> On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <bo...@gmx.net>
> wrote:
>
>> Hi all,
>> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
>> jdk11.0.4) doesn't read annotations at package level properly. If I'm not
>> mistaken for whatever reason this is a really nasty bug.
>>
>> Please have a look at this to reproduce:
>>
>> https://github.com/borisheithecker/packagelevelannotationtest
>>
>> If I run this small platform application with platform 11.1 and Java 11
>> selected, it fails (i.e. the package annotation is not found at runtime).
>> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
>> expected.
>>
>> I started porting a platform application yesterday which has been run on
>> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend the
>> whole day digging various sources on why the application fails to run on
>> Java 11 (with Metro JAX WS RI added as external library) until I found out
>> what seems to be the obvious reason now: it fails because JAXB can't
>> read @XmlSchema-annotations in package-info. Am I doing something wrong?
>>
>> Boris
>>
>

Re: NetBeans 11.1 with Java 11 fails to read package annotations

Posted by Geertjan Wielenga <ge...@apache.org>.
So first start by using the same JDK for both to see whether it is a JDK
problem (probably since JDK 11 is very different to JDK 8) or not.

Gj

On Sat, 12 Oct 2019 at 08:50, Boris Heithecker <bo...@gmx.net>
wrote:

> Hi all,
> it seems that a NetBeans 11.1 platform app running on Java 11 (oracle
> jdk11.0.4) doesn't read annotations at package level properly. If I'm not
> mistaken for whatever reason this is a really nasty bug.
>
> Please have a look at this to reproduce:
>
> https://github.com/borisheithecker/packagelevelannotationtest
>
> If I run this small platform application with platform 11.1 and Java 11
> selected, it fails (i.e. the package annotation is not found at runtime).
> If I run it with NetBeans 8.2 and Java 8_162 the annotation is found as
> expected.
>
> I started porting a platform application yesterday which has been run on
> 8.2 so far and which makes heavy use of JAXB and Web Services. I spend the
> whole day digging various sources on why the application fails to run on
> Java 11 (with Metro JAX WS RI added as external library) until I found out
> what seems to be the obvious reason now: it fails because JAXB can't
> read @XmlSchema-annotations in package-info. Am I doing something wrong?
>
> Boris
>