Hello Geertjan and other Netbeans users,
Problem description: In NB with uninstalled nb-javac plug-in, whilst editing
in a Java source file, a few seconds later NB raises a Null-pointer
exception; its stacktrace I attach below.
With a fresh NB profile I imported step by step the formerly exported NB
options (which threw the exception), until I could reproduce the Null-pointer
exception. So I encircled the problem to the export/import options section:
All -> General -> "All other unspecified". This means a setting in the NB
editor Hints options.
How to reproduce the bug step by step:
1) Netbeans 11.2 and 11.3_beta, here used with Ubuntu 18.04 LTS and an
apt-get installed OpenJDK "11.0.6" 2020-01-14
2) When NB asks to install nb-javac plugin, don't install it. In case it's
already installed, un-install it. With enabled nb-javac plugin, the
Null-pointer exception bug doesn't happen. (Also the refactoring-rename only
works fully with an non-installed nb-javac plug-in.)
3) I use Netbeans Ant projects with Java 11 source-format, but the bug could
probably also happen with other project types.
4) In NB's menu Tools -> Options -> Editor -> Hints -> Java, in section
"Standard javac warnings", enable the "Overrides" checkbox.
5) Create a new Swing GUI form class, add to it with Netbeans' GUI designer a
visual component which can have an action event, like a JCheckBox, then
register an action event, i.e. double click on the JCheckBox component, so
that NB creates an actionPerformed event method in the source code.
(By the way, surely there are other classes which would show the same
Null-pointer exception, but since I use such NB designed Swing classes a lot
currently, this is the fastest way I can reproduce the bug.)
6) Now manually edit some of your own code in the same source file, and a few
seconds later, when NB's parser wants to check the source code for potential
Override hint situations, it raises the Null-pointer exception.
7) Work-around: Disable the "Overrides" checkbox in the NB editor's hints
section.
Greetings,
Hans
-------------------------------------------------------------------------------
java.lang.NullPointerException
at
jdk.compiler/com.sun.tools.javac.comp.Check.checkClassOverrideEqualsAndHash(Check.java:2095)
at
jdk.compiler/com.sun.tools.javac.comp.Check.checkClassOverrideEqualsAndHashIfNeeded(Check.java:2085)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4577)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:951)
at org.netbeans.lib.nbjavac.services.NBAttr.visitClassDef(NBAttr.java:66)
at
jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:774)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
at
jdk.compiler/com.sun.tools.javac.comp.Attr.visitAnonymousClassDefinition(Attr.java:2397)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:2288)
at
jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1689)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:695)
at
org.netbeans.modules.java.hints.spiimpl.Utilities.attributeTree(Utilities.java:655)
at
org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:435)
at
org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:349)
at
org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:329)
at
org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:325)
at
org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler.compile(PatternCompiler.java:44)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.doComputeHints(HintsInvoker.java:535)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHintsImpl(HintsInvoker.java:283)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:228)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:193)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:166)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:128)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:114)
at
org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:65)
[catch] at
org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:273)
at
org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
at
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
at
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
at
org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
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)
Am 25.02.20 um 17:40 schrieb Geertjan Wielenga:
Without very clear steps and a full description of your environment, no one
can help.
Gj
On Tue, Feb 25, 2020 at 5:31 PM Hans Grimmelshausen HG <far...@mail.de
<mailto:far...@mail.de>> wrote:
Hello Geertjan and others,
Unfortunately also with NB 11.3 alpha, the same Null pointer exception
occurs frequently at compile time, with non-installed nb-java plugin.
But I observed the following:
While the null pointer exception in its stack-trace lists this (which
you quoted earlier) :
-> at
org.netbeans.lib.nbjavac.services.NBAttr.visitClassDef(NBAttr.java:66)
… and the nb-javac plugin isn't installed (which for many, including
me, would be located in the user's home, here under Linux it's:
.netbeans/11.2/ ), there's still a hard-wired module inside the
netbeans application folder, this:
-> netbeans/java/modules/org-netbeans-lib-nbjavac.jar
This jar file stays there, even if nb-javac plugin isn't installed (or
un-installed) in the user's home.
Could this be the problem?
For now, the situation for my mid-sized OpenJDK 11 project is as follows:
a) With installed nb-javac plugin:
No null-pointer exceptions at compile time, but refactoring-rename
doesn't work.
b) Without the nb-javac plugin:
Frequent null-pointer exceptions at compile time, however
refactoring-rename works fine.
Strange. The null pointer exception doesn't block anything, it seems,
i.e. I can continue to work with the project in NB. But since the
exception is shown in red an occurs frequently when compiling, it's
irritating. Also I am at my wits' end. :-)
Greetings,
Hans