You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Eric Bresie <eb...@gmail.com> on 2019/12/07 21:32:51 UTC

LangTool Build Error with Java 13

I hope this wasn't covered someplace else or maybe is some kind of JDK/Java
configuration issues in my netbeans setup but....

With the following java in place...

java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)


While trying to compile the latest netbeans from github as of 12/7/2019 of
the master, I got a few compilation errors relating to FileSystem class
methods like the following:


generate-sources-internal:
 [pcompile] Generating 6 resource files to
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\build\gensrc\jdk.jshell
    [mkdir] Created dir:
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\build\nb
    [javac] Compiling 593 source files to
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\build\nb
    [javac] warning: [options] bootstrap class path not set in conjunction
with -source 8
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\file\JavacFileManager.java:519:
error: reference to newFileSystem is ambiguous
    [javac]                 this.fileSystem =
FileSystems.newFileSystem(archivePath, null);
    [javac]                                              ^
    [javac]   both method newFileSystem(Path,ClassLoader) in FileSystems
and method newFileSystem(Path,Map<String,?>) in FileSystems match
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\file\Locations.java:383:
error: reference to newFileSystem is ambiguous
    [javac]                             FileSystems.newFileSystem(file,
null).close();
    [javac]                                        ^
    [javac]   both method newFileSystem(Path,ClassLoader) in FileSystems
and method newFileSystem(Path,Map<String,?>) in FileSystems match
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:89:
warning: AnnotationParser is internal proprietary API and may be removed in
a future release
    [javac]         return AnnotationParser.annotationForMap(annoType,
    [javac]                ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:168:
warning: ExceptionProxy is internal proprietary API and may be removed in a
future release
    [javac]             if (!(value instanceof ExceptionProxy) &&
    [javac]                                    ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:169:
warning: AnnotationType is internal proprietary API and may be removed in a
future release
    [javac]
!AnnotationType.invocationHandlerReturnType(returnClass)
    [javac]                  ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:205:
warning: ExceptionProxy is internal proprietary API and may be removed in a
future release
    [javac]                         if (value == null || value instanceof
ExceptionProxy) {
    [javac]                                                               ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:229:
warning: EnumConstantNotPresentExceptionProxy is internal proprietary API
and may be removed in a future release
    [javac]                     value = new
EnumConstantNotPresentExceptionProxy(
    [javac]                                 ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:259:
warning: ExceptionProxy is internal proprietary API and may be removed in a
future release
    [javac]             class AnnotationTypeMismatchExceptionProxy extends
ExceptionProxy {
    [javac]                                                                ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:283:
warning: ExceptionProxy is internal proprietary API and may be removed in a
future release
    [javac]     private static final class MirroredTypeExceptionProxy
extends ExceptionProxy {
    [javac]
  ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\model\AnnotationProxyMaker.java:326:
warning: ExceptionProxy is internal proprietary API and may be removed in a
future release
    [javac]     private static final class MirroredTypesExceptionProxy
extends ExceptionProxy {
    [javac]
   ^
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\platform\JDKPlatformProvider.java:80:
error: reference to newFileSystem is ambiguous
    [javac]             try (FileSystem fs =
FileSystems.newFileSystem(ctSymFile, null);
    [javac]                                             ^
    [javac]   both method newFileSystem(Path,ClassLoader) in FileSystems
and method newFileSystem(Path,Map<String,?>) in FileSystems match
    [javac]
C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\platform\JDKPlatformProvider.java:120:
error: reference to newFileSystem is ambiguous
    [javac]                         ctSym2FileSystem.put(file, fs =
FileSystems.newFileSystem(file, null));
    [javac]
   ^
    [javac]   both method newFileSystem(Path,ClassLoader) in FileSystems
and method newFileSystem(Path,Map<String,?>) in FileSystems match
    [javac] 4 errors
    [javac] 9 warnings

BUILD FAILED


Based on looking around I find with newer versions of java has multiple
FileSystem methods defined so this requires casting the second parameter to
ClassLoader class as described  Java 13 release notes[1]

I thought...this seems like a simple fix (adding a cast) which maybe I
could try to contribute but after making the change and trying to build it
again, the same errors occur.  I came to realize these files are copied
over during build setup, I find the files in question are in the langtools
subfolder which appears to be uncompressed from the external
langtools-9.zip file present so those fixes don't go through.

Assume this is a "downstream" (langtools) sort of change needed (maybe from
java context) which I believe the langtools is managed [2].  But not sure
of this.

Anyone have any ideas on this?

References
[1]  https://www.oracle.com/technetwork/java/13-relnote-issues-5460548.html
[2]
https://github.com/openjdk/jdk13/tree/master/make/langtools/netbeans/langtools



Eric Bresie
ebresie@gmail.com

Re: LangTool Build Error with Java 13

Posted by John Neffenger <jo...@status6.com>.
On 12/7/19 1:32 PM, Eric Bresie wrote:
>      [javac]
> C:\src\git\netbeans.eric\netbeans\nbbuild\build\langtools\src\jdk.compiler\share\classes\com\sun\tools\javac\platform\JDKPlatformProvider.java:120:
> error: reference to newFileSystem is ambiguous
>      [javac]                         ctSym2FileSystem.put(file, fs =
> FileSystems.newFileSystem(file, null));
>      [javac]
>     ^
>      [javac]   both method newFileSystem(Path,ClassLoader) in FileSystems
> and method newFileSystem(Path,Map<String,?>) in FileSystems match
>      [javac] 4 errors
>      [javac] 9 warnings
> 
> BUILD FAILED

Those are the same errors I encountered when the "java" command on my 
PATH was not the same as that defined by JAVA_HOME. See the following 
message on the mailing list:

Re: Building NetBeans 11.1 from source fails with compile errors
https://mail-archives.apache.org/mod_mbox/netbeans-dev/201910.mbox/%3C26c1f141-b021-4473-059f-41ec0b5e3613%40status6.com%3E

You might be hitting the same problem. The issue is described here:

NETBEANS-3209: Add JAVA_HOME and ANT_HOME note
https://issues.apache.org/jira/browse/NETBEANS-3209

The associated pull request is here:

apache/netbeans#1554
https://github.com/apache/netbeans/pull/1554

John

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists