Long time no see Humphrey! Thanks a lot for your simplified test case. It makes sense to record it into JIRA for tracking purposes.
I talked about your problem with Jan Lahoda and we believe that the best way to fix the problem is to eliminate differences between Javac and NbJavac as discussed in https://lists.apache.org/thread.html/r5f210c99b0926aeaac2d0c3c419ff4b79e01f15b67c5ddcf32a51bbe%40%3Cdev.netbeans.apache.org%3E that however is going to take about a year. Reporting JIRA issue may possibly speed resolution of the problem by other means[1] without waiting for implementation of the "big idea". -jt [1] by fixing the bug in current nb-javac. Ășt 22. 12. 2020 v 9:16 odesĂlatel Humphrey Clerx <[email protected]> napsal: > I've been able to narrow the problem down and have an example module suite > that shows the problem. > > It turned out it has nothing to do with duplicate classes being defined in > different modules and both being visible in other modules. The problem is > with the one file StringUtils in one module. > > When opening the suite and the modules the "error badges" appear. The > "error badges" also appear in the Unit Test package in the same module. > > This problem happens with any NetBeans 12.x when using nb-javac. > > The problem itself seems to be caused by the String lookup arrays > OCTAL_NUMBERS and NUMBERS. If you remove these and refactor the code to use > Integer.toString(val), the "error badges" disappear. > > When deactivating and removing nb-javac, so that the JDK_1.8 javac is > used, the "error badges" also don't appear (even with the lookup arrays). > > It seems nb-javac has a problem parsing/caching/... the class StringUtils, > such that it's no longer visible in other modules. It's cumbersome to > knwo why this is happening, since nb-javac gived no logging output, other > than several NPE's in the messages.log and the INFO log entries. > > INFO [org.netbeans.api.java.source.ElementHandle]: Resolved type is null > for kind = CLASS > INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve: > ElementHandle[kind=CLASS; > sigs=org.nato.unclassified.mice.common.util.StringUtils ] > INFO [org.netbeans.modules.java.editor.imports.ComputeImports]: Cannot > resolve type element "ElementHandle[kind=CLASS; > sigs=org.nato.unclassified.mice.common.util.StringUtils ]". > > > Maybe someone can shed some light on why this is and possibly fix it for > NB 12.3? > > Greets, > Humphrey. > > > On Fri, Dec 18, 2020 at 3:11 PM Humphrey Clerx <[email protected]> wrote: > >> I checked the messages.log of NetBeans 12.2 and found the following kind >> of entries: >> >> INFO [org.netbeans.api.java.source.ElementHandle]: Resolved type is null >> for kind = CLASS >> INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve: >> ElementHandle[kind=CLASS; >> sigs=org.nato.unclassified.mice.common.util.StringUtils ] >> INFO [org.netbeans.modules.java.editor.imports.ComputeImports]: Cannot >> resolve type element "ElementHandle[kind=CLASS; >> sigs=org.nato.unclassified.mice.common.util.StringUtils ]". >> >> And the log is also full of the following entries: >> >> java.lang.NullPointerException >> WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: >> MultiPassCompileWorker caused an exception >> >> >> >> >> On Fri, Dec 11, 2020 at 2:21 PM Javier Ortiz Bultron < >> [email protected]> wrote: >> >>> Yup, exactly the same behavior I reported. Maybe you can add more details >>> there. >>> >>> https://issues.apache.org/jira/browse/NETBEANS-4931 >>> >>> >>> >>> On Fri, Dec 11, 2020 at 3:34 AM Humphrey Clerx <[email protected]> wrote: >>> >>> > 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 >>> > ,__/> >>> > <" >>> > ' >>> > >>> >> >> >> -- >> In the mountains of truth, you never climb in vain - Nietzsche >> #------------------------------------------------------------- >> \_O >> ,__/> >> <" >> ' >> > > > -- > In the mountains of truth, you never climb in vain - Nietzsche > #------------------------------------------------------------- > \_O > ,__/> > <" > ' > > --------------------------------------------------------------------- > 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 > >
