This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 259024 - NetBeans modules that use annotations processed by NetBeans processors do not build using Java 1.9
Summary: NetBeans modules that use annotations processed by NetBeans processors do not...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Lookup (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-26 13:52 UTC by Jachym_Vojtek
Modified: 2016-05-05 01:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example suite on which build using JDK 1.9 fails (7.78 KB, application/x-zip-compressed)
2016-04-26 15:57 UTC, Jachym_Vojtek
Details
Suggested patch for Lookup API module (1.72 KB, application/octet-stream)
2016-05-04 10:32 UTC, Jachym_Vojtek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jachym_Vojtek 2016-04-26 13:52:21 UTC
JDK 1.9 javac 9-ea linux 64bit, downloaded from https://jdk9.java.net/jigsaw/

NetBeans modules that we use in JDeveloper cannot be compiled due to java.nio.file.NoSuchException thrown by the annotations processors launched during compilation.

There is an issue in org-openide-util-lookup.jar  org.openide.util.lookup.implspi.AbstractServiceProviderProcessor which catches exception FileNotFoundException in case the Filer of annotation processor does not find a file. It seems that since Java 1.9 Filer does not throw FileNotFoundException but NoSuchFileException. Both exceptions thrown in Filer extend IOException, and since the API says that IOException is thrown, this is still compatible change. But the AbstractServiceProviderProcessor code should also catch NoSuchFileException 
in the situations it treated only FileNotFoundException.

We succeeded to compile the JDeveloper NetBeans modules when with the changed code of (org-openide-filesystem.jar) org.openide.filesystems.annotations.LayerGeneratingProcessor and (org-openide-util-lookup.jar)  org.openide.util.lookup.implspi.AbstractServiceProviderProcessor that caught java.nio.file.NoSuchFileException along with FileNotFoundException.

Could you please fix code of annotation processors to work with Java 1.9?
Comment 1 Jachym_Vojtek 2016-04-26 15:57:27 UTC
Created attachment 159445 [details]
Example suite on which build using JDK 1.9 fails

I succeeded to reproduce the error on windows with Java 1.9 (downloaded from
https://jdk9.java.net/jigsaw/)

D:\docum\java_versioned\suite1\module1>c:\java\jdk9\bin\java.exe -version
java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+115-2016-04-24-235632.javare.4894.nc)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+115-2016-04-24-235632.javare.4894.nc, mixed mode)

1) Open the suite in NetBeans
2) In command line cd to suite1/module1
3) Launch ant with Java 1.9 used (set JAVACMD=path_to_jdk_root\jdk9\bin\java.exe)

Notice the compile error:
[nb-javac] error: Failed to read generated-layer.xml: java.nio.file.NoSuchFileException: D:\XXX\suite1\module1\build\classes\META-INF\generated-layer.xml
Comment 2 Jachym_Vojtek 2016-05-04 10:32:03 UTC
Created attachment 159530 [details]
Suggested patch for Lookup API module

I checked that code in LayerGeneratingProcessor has been already fixed (bug 253337) so only code in AbstractServiceProviderProcessor should catch NoSuchFileException in addition to FileNotFoundException.
I do not use multicatch syntax for AbstractServiceProviderProcessor as source level for this module is still 1.6.

I guess Martin Entlicher is the right person to consult the suggested change, if needed, as he was the assignee for already fixed 253337.
Comment 3 Martin Entlicher 2016-05-04 14:06:48 UTC
Fixed by changeset:   297081:b05965a8216d
http://hg.netbeans.org/core-main/rev/b05965a8216d
Comment 4 Quality Engineering 2016-05-05 01:53:21 UTC
Integrated into 'main-silver', will be available in build *201605050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b05965a8216d
User: mentlicher@netbeans.org
Log: #259024: Catch NoSuchFileException.