Currently we are using NetBeans 8.2 using JDK 1.8 (AdoptOpenJDK 8u272)
under Windows 10 (and Solaris 11.3).
Our project is a NetBeans Platform Application, consisting of several
Module Suites with several Modules. Our project sets an explicit Java
Platform to use (nbjdk.active=JDK_1.8). We use Ant for building the project.
All of this works fine. But recently I tried to migrate to using NetBeans
12.2 with nb-javac installed and enabled. I installed NetBeans 12.2 and
configured it to run with JDK 11 (AdoptOpenJDK 11.0.9) as the default JDK
(by setting jdk_home in netbeans.conf).
I then ran NB12.2 without importing settings from NB8.2. Then I defined an
additional Java Platform to point to the AdoptOpenJDK 1.8 installation
folder to define the JDK_1.8 platform property.
If I then open our project and all the modules, NB12.2 starts a background
scan. During this scanning it throws numerous NPE's (almost every second).
I'll add the stacktrace at the end of this mail.
And on multiple files an "error badge" appears because it imports a class
(StringUtils) that happens to be defined in two independent modules in our
project (this is to avoid cyclic dependency and visibility between modules
needing this class).
The error badge appears on the import of StringUtils from the one module
only, not on the imports of StringUtils from the other module. The error
badge does not appear on the import in the same module where StringUtils is
defined, but it does appear on the use of StringUtils in the Unit Test
Packages in the module.
The error badge states the following:
cannot find symbol
symbol: class StringUtils
location: package common.util
When selecting the "error badge" it asks to "Change to import <package
name>.StringUtils", suggesting the other StringUtils.java class.
Note that when I use Ctrl-O to open the "Go to Type" dialog and type
StringUtils it find both instances of StringUtils (plus some additional
ones e.g. com.sun.xml.internal.ws.util.StringUtils).
I tried doing the same with completely disabling/uninstalling nb-javac and
ran 12.2 again from scratch. Doing this, the NPE's still occur, but the
"error badges" problem disappears.
I tried doing the same with installing NB 12.1 (without nb-javac). This
also stops the NPE's. Installing/enabling nb-javac brings back the "error
badges" in NB 12.1 as well though.
To me it seems nb-javac has a problem with determining visibility of
classes between modules when (multiple) classes are defined with the same
name but that live in a different package/module.
And it seems something is broken in NB12.2 with respect to the Background
scanning in that it throws NPE's all the time.
For now I'm using NB12.1 (without nb-javac) and that at least solves my
"error badge" and NPE problems, but the scanning/etc of javac as opposed to
using nb-javac seems to slow down the display of e.g. Java Hints and other
things inside the editor and/or when doing "Find Usages".
Note that I'm not having ANY of these problems with NB 8.2 (using nb-javac).
Is there anyone who can give some idea on how/why these "error badges"
appear?
And/or why NB12.2 seems to throw so many NPE's (as opposed to NB12.1)?
Greets,
Humphrey.
----- NPE stacktrace ----
java.lang.NullPointerException
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:914)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2500(JavacProcessingEnvironment.java:113)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1298)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1380)
at
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1350)
at
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1240)
at
com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:404)
at
com.sun.tools.javac.api.JavacTaskImpl.enterTrees(JavacTaskImpl.java:451)
[catch] at
org.netbeans.modules.java.source.nbjavac.indexing.MultiPassCompileWorker.compile(MultiPassCompileWorker.java:204)
at
org.netbeans.modules.java.source.indexing.JavaCustomIndexer.index(JavaCustomIndexer.java:361)
at
org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$2.run(Indexable.java:138)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
at
org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:136)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2750)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
at
org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5714)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork$4.call(RepositoryUpdater.java:5622)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSource(RepositoryUpdater.java:5749)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$AbstractRootsWork.scanSources(RepositoryUpdater.java:5419)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:5038)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
at
org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
at
org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
at
org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
at
org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
at
org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
at
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
--
In the mountains of truth, you never climb in vain - Nietzsche
#-------------------------------------------------------------
\_O
,__/>
<"
'