apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 846 forks source link

Compile error but no line indicators #7467

Open mclaborn opened 3 months ago

mclaborn commented 3 months ago

Apache NetBeans version

Apache NetBeans 22

What happened

This happens to me occasionally, usually when editing a fairly large java file. The icon in the tab will show a red indicator for a compile error, but there are no red indicators on the right gutter to show which lines have the error(s). If I'm lucky enough to find one the errors on my own, the method call will be in italics, showing an error, but there is no red indicator on the right.

Re-opening NetBeans does not help, nor does re-opening the file in question. The only way I've found to recover is to close NetBeans, delete the cache directory, then re-open NetBeans. There has been some discussion on the users mailing list, under a thread "Compile error but no line indicators". Everyone there is also correcting by clearing the cache.

Language / Project Type / NetBeans Component

No response

How to reproduce

Cannot reproduce at will. The files where it happens are rather large (> 5000 lines). Maybe some kind of diagnostic tool could capture helpful info?

Did this work correctly in an earlier version?

No / Don't know

Operating System

Ubuntu 22.04

JDK

Java: 17.0.11; OpenJDK 64-Bit Server VM 17.0.11+9-Ubuntu-122.04.1

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

Product Version: Apache NetBeans IDE 22 Java: 17.0.11; OpenJDK 64-Bit Server VM 17.0.11+9-Ubuntu-122.04.1 Runtime: OpenJDK Runtime Environment 17.0.11+9-Ubuntu-122.04.1 System: Linux version 5.15.0-112-generic running on amd64; UTF-8; en_US (nb) User directory: /home/mclaborn/.netbeans/22 Cache directory: /home/mclaborn/.cache/netbeans/22

Are you willing to submit a pull request?

No

neilcsmith-net commented 3 months ago

Do you see any error notification at the bottom? Can you check messages.log or in View / IDE log and share any errors there?

This sounds similar to #7437 to an extent - I wonder if similar errors show up here?

THausherr commented 3 months ago

I'm having it right now, but unlike the OP, restarting netbeans fixes it, and it's not related to the file size. Here's what I got after adding a syntax error:

INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: CancelableTaskWrapper[task: org.netbeans.modules.java.hints.infrastructure.LazyHintComputation@2dafff82, phase: RESOLVED, priority: 500] : class org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper ignored cancel for 60 ms.
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=jdk.nashorn.internal.objects.Global ]
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=com.sun.org.apache.bcel.internal.classfile.Annotations ]
INFO [org.netbeans.modules.java.editor.imports.ComputeImports]: Cannot resolve type element "ElementHandle[kind=CLASS; sigs=com.sun.org.apache.bcel.internal.classfile.Annotations ]".
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=com.sun.tools.javac.code.TypeMetadata$Annotations ]
INFO [org.netbeans.modules.java.editor.imports.ComputeImports]: Cannot resolve type element "ElementHandle[kind=CLASS; sigs=com.sun.tools.javac.code.TypeMetadata$Annotations ]".
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=com.sun.tools.javac.tree.TreeMaker ]

after fixing it:

INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing 25.258 ms.
INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 0 ms.
INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing 1.914 ms.

When the first InstanceContent was created, the StackTrace was:

Line: 2.450, ClassName.methodName: java.lang.Thread.getStackTrace
Line: 94, ClassName.methodName: org.netbeans.modules.maven.j2ee.osgi.OsgiLookupProvider.createAdditionalLookup
Line: 142, ClassName.methodName: org.netbeans.spi.project.support.DelegatingLookupImpl.doDelegate
Line: 76, ClassName.methodName: org.netbeans.spi.project.support.DelegatingLookupImpl.<init>
Line: 86, ClassName.methodName: org.netbeans.spi.project.support.LookupProviderSupport.createCompositeLookup
Line: 282, ClassName.methodName: org.netbeans.modules.maven.NbMavenProjectImpl.<init>
Line: 98, ClassName.methodName: org.netbeans.modules.maven.NbMavenProjectFactory.loadProject
Line: 376, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.createProject
Line: 69, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.access$300
Line: 289, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager$2.run
Line: 218, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager$2.run
Line: 188, ClassName.methodName: org.netbeans.modules.openide.util.DefaultMutexImplementation.readAccess
Line: 232, ClassName.methodName: org.openide.util.Mutex.readAccess
Line: 218, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.findProject
Line: 142, ClassName.methodName: org.netbeans.api.project.ProjectManager.findProject
Line: 1.283, ClassName.methodName: org.netbeans.modules.project.ui.OpenProjectList.URLs2Projects
Line: 116, ClassName.methodName: org.netbeans.modules.project.ui.OpenProjectList.access$1400
Line: 471, ClassName.methodName: org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.loadOnBackground
Line: 384, ClassName.methodName: org.netbeans.modules.project.ui.OpenProjectList$LoadOpenProjects.run
Line: 1.420, ClassName.methodName: org.openide.util.RequestProcessor$Task.run
Line: 45, ClassName.methodName: org.netbeans.modules.openide.util.GlobalLookup.execute
Line: 287, ClassName.methodName: org.openide.util.lookup.Lookups.executeWith
Line: 2.035, ClassName.methodName: org.openide.util.RequestProcessor$Processor.run
When the second InstanceContent was created, the StackTrace was: 
Line: 2.450, ClassName.methodName: java.lang.Thread.getStackTrace
Line: 101, ClassName.methodName: org.netbeans.modules.maven.j2ee.osgi.OsgiLookupProvider.createAdditionalLookup
Line: 142, ClassName.methodName: org.netbeans.spi.project.support.DelegatingLookupImpl.doDelegate
Line: 76, ClassName.methodName: org.netbeans.spi.project.support.DelegatingLookupImpl.<init>
Line: 86, ClassName.methodName: org.netbeans.spi.project.support.LookupProviderSupport.createCompositeLookup
Line: 282, ClassName.methodName: org.netbeans.modules.maven.NbMavenProjectImpl.<init>
Line: 98, ClassName.methodName: org.netbeans.modules.maven.NbMavenProjectFactory.loadProject
Line: 376, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.createProject
Line: 69, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.access$300
Line: 289, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager$2.run
Line: 218, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager$2.run
Line: 188, ClassName.methodName: org.netbeans.modules.openide.util.DefaultMutexImplementation.readAccess
Line: 232, ClassName.methodName: org.openide.util.Mutex.readAccess
Line: 218, ClassName.methodName: org.netbeans.modules.projectapi.nb.NbProjectManager.findProject
Line: 142, ClassName.methodName: org.netbeans.api.project.ProjectManager.findProject
Line: 144, ClassName.methodName: org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner
Line: 93, ClassName.methodName: org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner
Line: 125, ClassName.methodName: org.netbeans.api.project.FileOwnerQuery.getOwner
Line: 42, ClassName.methodName: org.netbeans.modules.java.project.ProjectSourceForBinaryQuery.findSourceRoots
Line: 71, ClassName.methodName: org.netbeans.api.java.queries.SourceForBinaryQuery.findSourceRoots
Line: 140, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeOverriders.findBinaryRootsForSourceRoot
Line: 304, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeOverriders.reverseSourceRootsInOrder
Line: 349, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeOverriders.computeUsers
Line: 203, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeOverriders.processImpl
Line: 154, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeOverriders.process
Line: 104, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeAnnotations.computeAnnotations
Line: 85, ClassName.methodName: org.netbeans.modules.java.editor.overridden.ComputeAnnotations.run
Line: 561, ClassName.methodName: org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask
Line: 786, ClassName.methodName: org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run
Line: 288, ClassName.methodName: org.openide.util.lookup.Lookups.executeWith
Line: 702, ClassName.methodName: org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute
Line: 663, ClassName.methodName: org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run
Line: 572, ClassName.methodName: java.util.concurrent.Executors$RunnableAdapter.call
Line: 317, ClassName.methodName: java.util.concurrent.FutureTask.run
Line: 1.420, ClassName.methodName: org.openide.util.RequestProcessor$Task.run
Line: 45, ClassName.methodName: org.netbeans.modules.openide.util.GlobalLookup.execute
Line: 287, ClassName.methodName: org.openide.util.lookup.Lookups.executeWith
Line: 2.035, ClassName.methodName: org.openide.util.RequestProcessor$Processor.run
INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 4.298 ms.
mclaborn commented 3 months ago

Finally got an instance of this. There was one exception at the bottom of the NB window - see attached stack1.txt. I'm not sure if it is related - the time in the Notifications window could have been before the error occurred. ide.log is also attached. From that log: com.mm.server.inventory.app.OrderFunctions2 is the file that I was working in.

I cleared the view of the IDE log and then repeated the edit that triggered the problem. Those log entries are at line 2004 in ide.log.

[note to self that might reproduce: replace mydil.createCustomerObject().getByID(o.getCustomerid()) with l_cust_cache.getByID(...)]

stack1.txt ide.log

mclaborn commented 1 month ago

Any progress on this? It is really costing me a lot of time.