You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using @SuppressWarnings annotation (without any braces parameter)
Caused: java.lang.NullPointerException: Cannot read field "values" because "values" is null
at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:765)
...
@lahodaj this is reproducible and looks like a problem in the Linter. Would you mind having a look?
I got this in the IDE:
Caused: java.lang.NullPointerException: Cannot read field "values" because "values" is null
at com.sun.tools.javac.code.Lint.suppressionsFrom(Lint.java:532)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
matthias@enterprise:~/NetBeansProjects/MavenSpielwiese/src/main/java$ LANG=C ~/bin/jdk-25/bin/javac -XDshould-stop.at=FLOW -XDdev Test.java
Test.java:2: error: annotation @SuppressWarnings is missing a default value for the element 'value'
@SuppressWarnings
^
1 error
An exception has occurred in the compiler (25). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot read field "values" because "values" is null
at jdk.compiler/com.sun.tools.javac.code.Lint.suppressionsFrom(Lint.java:532)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:214)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
at jdk.compiler/com.sun.tools.javac.code.Lint.suppressionsFrom(Lint.java:524)
at jdk.compiler/com.sun.tools.javac.code.Lint.suppressionsFrom(Lint.java:511)
at jdk.compiler/com.sun.tools.javac.code.Lint.augment(Lint.java:82)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5414)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5302)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1346)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:968)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
printing javac parameters to: /tmp/javac.20250810_151958.args
matthias@enterprise:~/NetBeansProjects/MavenSpielwiese/src/main/java$
will put NB 28 on this issue since its too late for NB 27 most likely (I don't think more RCs are planned and the nb-javac + patch roundtrip would take time and require someone who would want to do that).
Workaround (for users) would be to help javac by adding ("") to the annotation, this allows auto-completion.
Assuming JDK-8365314 will be in JDK 25.0.1, NB 27 could be also run on JDK 25 with nb-javac uninstalled, but by that time NB 28 wouldn't be far away anymore.
Well, this bug is a shame and somewhat annoying! I'm not sure it's useful to be showing the error notification for a bunch of parsing errors we currently have.
I've looked at part of this stack trace before with another bug. As well as this being a JDK issue, I'm curious at the behaviour of JavacParser::moveToPhase. This method is documented to throw an IOException when javac throws any exception here but doesn't do so. This means it bypasses the catch that throws a ParseExceptionhere. Is that intentional behaviour?
EDIT : I'm not sure that would change the exception being reported in this particular case. I do question which exceptions are meant to be used, and which should be reported in the UI vs logging.
IMO: trying to hide exceptions is the wrong approach, particularly with javac problems since it is not possible to tell what the consequence of the failure is. It can cause error badges in files when the parser gives up, it can cause a refactoring failure or it cause completion to not work.
I get that exceptions also happen while typing which can be harmless, but trying to filter those out might not be worth the efforts and cause obfuscation of the above mentioned issues.
That kind of misses my point. The parsing code already filters by exception types in a bunch of places. Javacparser doesn't seem to follow its own documented behaviour.
We can try to tweak exception handling a bit so that error badges can show up on the file using this as test scenario. But there is only so much we can do with exception handling before javac has to be fixed.
Hiding javac exceptions was brought up before, I only wanted to reiterate that I don't think this would be a good idea, those are real problems in many cases.
We shouldn't be hiding javac exceptions. Whether it should be a log or UI message is somewhat open to debate. That's a secondary question.
I'm first trying to understand why JavacParser is not throwing the exception it states it does, and what the consequences of or decision behind that is? Is it deliberate?
Whether it should be a log or UI message is somewhat open to debate. That's a secondary question.
both, since it increases the chances that we get an reproducer for harder to find issues. It also helps to connect symptoms with issues for users "completion didn't work, ah I see a red marker in the bottom corner".
I'm first trying to understand why JavacParser is not throwing the exception it states it does, and what the consequences of or decision behind that is? Is it deliberate?
i don't know. But if changing it would give us error markers in files when comparable issues occur it would be something to consider.
Activity
matthiasblaesing commentedon Aug 10, 2025
@lahodaj this is reproducible and looks like a problem in the Linter. Would you mind having a look?
I got this in the IDE:
Looking at the code in:
https://github.com/openjdk/jdk/blob/022e29a77533aacabd56820d00ecffa9646a8362/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java#L528-L541
there is a null check missing.
That code breaks independent from the IDE (tested with
Build 35 (2025/8/8)):lahodaj commentedon Aug 12, 2025
FYI: https://bugs.openjdk.org/browse/JDK-8365314
mbien commentedon Aug 14, 2025
will put NB 28 on this issue since its too late for NB 27 most likely (I don't think more RCs are planned and the nb-javac + patch roundtrip would take time and require someone who would want to do that).
Workaround (for users) would be to help javac by adding
("")to the annotation, this allows auto-completion.Assuming JDK-8365314 will be in JDK 25.0.1, NB 27 could be also run on JDK 25 with nb-javac uninstalled, but by that time NB 28 wouldn't be far away anymore.
neilcsmith-net commentedon Aug 18, 2025
Well, this bug is a shame and somewhat annoying! I'm not sure it's useful to be showing the error notification for a bunch of parsing errors we currently have.
I've looked at part of this stack trace before with another bug. As well as this being a JDK issue, I'm curious at the behaviour of
JavacParser::moveToPhase. This method is documented to throw anIOExceptionwhen javac throws any exception here but doesn't do so. This means it bypasses the catch that throws aParseExceptionhere. Is that intentional behaviour?EDIT : I'm not sure that would change the exception being reported in this particular case. I do question which exceptions are meant to be used, and which should be reported in the UI vs logging.
mbien commentedon Aug 18, 2025
IMO: trying to hide exceptions is the wrong approach, particularly with javac problems since it is not possible to tell what the consequence of the failure is. It can cause error badges in files when the parser gives up, it can cause a refactoring failure or it cause completion to not work.
I get that exceptions also happen while typing which can be harmless, but trying to filter those out might not be worth the efforts and cause obfuscation of the above mentioned issues.
neilcsmith-net commentedon Aug 18, 2025
That kind of misses my point. The parsing code already filters by exception types in a bunch of places.
Javacparserdoesn't seem to follow its own documented behaviour.mbien commentedon Aug 18, 2025
We can try to tweak exception handling a bit so that error badges can show up on the file using this as test scenario. But there is only so much we can do with exception handling before javac has to be fixed.
Hiding javac exceptions was brought up before, I only wanted to reiterate that I don't think this would be a good idea, those are real problems in many cases.
mbien commentedon Aug 18, 2025
added mbien/nb-reprorepo@0696a1a to simplify testing
neilcsmith-net commentedon Aug 18, 2025
We shouldn't be hiding javac exceptions. Whether it should be a log or UI message is somewhat open to debate. That's a secondary question.
I'm first trying to understand why
JavacParseris not throwing the exception it states it does, and what the consequences of or decision behind that is? Is it deliberate?mbien commentedon Aug 18, 2025
both, since it increases the chances that we get an reproducer for harder to find issues. It also helps to connect symptoms with issues for users "completion didn't work, ah I see a red marker in the bottom corner".
i don't know. But if changing it would give us error markers in files when comparable issues occur it would be something to consider.