Dne úterý 9. února 2021 22:02:14 CET, Brad Walker napsal(a): > Hey Jaroslav, > > I have a question related to this. > > What would be the proper, accepted way to build Netbeans using JDK11?
Hello Brad, [in November](https://lists.apache.org/thread.html/ r94d421ce16f609687c769125425b46f2322033879120b00afddbe17b%40%3Cdev.netbeans.apache.org%3E) I was experimenting with: > Let's enable usage of `--release` in our Ant Javac task and let's make it > the same as the `javac.target` value: ```diff --- a/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java +++ b/nbbuild/antsrc/org/netbeans/nbbuild/CustomJavac.java @@ -66,6 +66,11 @@ @Override public void execute() throws BuildException { + String tgr = getTarget(); + if (tgr.matches("\\d+")) { + tgr = "1." + tgr; + } + setRelease(tgr.substring(2)); String src = getSource(); if (src.matches("\\d+")) { src = "1." + src; ``` That immediately shows errors in our code base. Just compile with JDK-11 and you'll see errors like: ```bash [nb-javac] Compiling 8 source files to /netbeans/platform/queries/build/ classes [nb-javac] Ignoring source, target and bootclasspath as release has been set [repeat] warning: [options] source value 6 is obsolete and will be removed in a future release [repeat] warning: [options] target value 1.6 is obsolete and will be removed in a future release [repeat] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. [repeat] /netbeans/platform/queries/src/org/netbeans/api/queries/ VersioningQuery.java:52: error: cannot find symbol [repeat] java.util.Objects.requireNonNull(uri); [repeat] ^ [repeat] symbol: class Objects [repeat] location: package java.util [repeat] 1 error [repeat] 3 warnings [nbmerge] Failed to build target: all-queries ``` What's the problem? In spite our code sets the `javac.target=1.6`, it is using API which isn't present in JDK6. That's wrong. Let's fix that! We need a Travis job using JDK-11 to compile (JDK8 doesn't support the `-- release` flag and Ant javac task just ignores it) and then we need us to fix all the compilation issues found. If the change is done properly (and the `--release` flag is used at all compilations), we can drop the requirement to use JDK8 to compile Apache NetBeans. Yet the code will still run on JDK8 thanks to using `--release 8` or older. How does that sound? Jaroslav Tulach NetBeans Platform Architect --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
