apache / apache/netbeans

NPE triggered by Compilation job

Open
#8,616 1 comment 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 26

### What happened

Playing with a reporters example I happened to trigger an NPE.
I will add the source code as zip file and see if I can reproduce the sequence of events.

For now, here is the stack trace:

```shell
Annotation: An error occurred during parsing of '/home/hom/NetBeansProjects/orderexport/src/main/java/com/mycompany/orderexport/MMOrderExport.java'. Please report a bug against java/source and attach dump file '/home/hom/.netbeans/26/var/log/MMOrderExport.dump'.
Annotation: An error occurred during parsing of '/home/hom/NetBeansProjects/orderexport/src/main/java/com/mycompany/orderexport/MMOrderExport.java'. Please report a bug against java/source and attach dump file '/home/hom/.netbeans/26/var/log/MMOrderExport.dump'.
Annotation: An error occurred during parsing of '/home/hom/NetBeansProjects/orderexport/src/main/java/com/mycompany/orderexport/MMOrderExport.java'. Please report a bug against java/source and attach dump file '/home/hom/.netbeans/26/var/log/MMOrderExport.dump'.
An error occurred during parsing of '/home/hom/NetBeansProjects/orderexport/src/main/java/com/mycompany/orderexport/MMOrderExport.java'. Please report a bug against java/source and attach dump file '/home/hom/.netbeans/26/var/log/MMOrderExport.dump'.
An error occurred during parsing of '/home/hom/NetBeansProjects/orderexport/src/main/java/com/mycompany/orderexport/MMOrderExport.java'. Please report a bug against java/source and attach dump file '/home/hom/.netbeans/26/var/log/MMOrderExport.dump'.
Caused: java.lang.NullPointerException: Cannot read field "info" because "lintEnv" is null
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5389)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5344)
at org.netbeans.lib.nbjavac.services.NBAttr.attribClass(NBAttr.java:74)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:5281)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1356)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1329)
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
at com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
Caused: java.lang.IllegalStateException
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:765)
at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:536)
at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:140)
at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:241)
at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:288)
at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
[catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

```

### Language / Project Type / NetBeans Component

java, module java.base

### How to reproduce

I am working on that.
But from my head: implement a private field with getters and setter in the top most class in the example zit file.
I am sure the I did not explicitly invoke the compiler. Compile on save is off.
It is probably trigger by some analysis process.

[orderexport.zip](https://github.com/user-attachments/files/20866905/orderexport.zip)

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

ubuntu 24.04

### JDK

21

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

I am not sure if I can create a fail-safe scenario.

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Start with the attached orderexport.zip and the stack trace, then inspect org.netbeans.lib.nbjavac.services.NBAttr.attribClass and the parsing path through JavacParser.java and TaskProcessor$CompilationJob.run. Reproduce the reported analysis-time NPE with Java 21 and NetBeans 26, and consider the issue done when the scenario no longer fails or a confirmed cause is documented with a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.