Well it was still happening, but I traced to a piece of code in just one file. 
It was compiling but something about NetBeans did not like it at all and was 
throwing this error. I used 12.5 on JDK17 and 11 and then 12.6-RC2 on JDK17 all 
throwing the same error. I can only imagine there was something corrupt in the 
file. I removed that excerpt and suddenly no problem. I rewrote the logic block 
in the same file and low and behold no issue. I moved the offending block to a 
new file and the NPE pops up again. I would love to share it, but it’s closed 
source so we’ll chalk this up to something inept that I did!!

Thanks Neil!


On 9 Nov 2021, at 14:43, Luff, Chris 
<chris.l...@cerner.com.INVALID<mailto:chris.l...@cerner.com.INVALID>> wrote:


Hey all,

I am getting an NPE on com.sun.source.tree.Tree.getKind() frequently in Java 
files. Anybody else seen this before I log a Jira?

  <param>Mac OS X, 11.5, x86_64</param>
  <param>OpenJDK 64-Bit Server VM, 17.0.1+12-LTS, OpenJDK Runtime Environment, 
17.0.1+12-LTS</param>
  <param>Apache NetBeans IDE 12.5</param>
  <param></param>
  <param>NullPointerException: Cannot invoke 
"com.sun.source.tree.Tree.getKind()" because "tree" is null</param>

java.lang.NullPointerException: Cannot invoke 
"com.sun.source.tree.Tree.getKind()" because "tree" is null
at com.sun.source.util.TreePath.<init>(TreePath.java:107)
at 
org.netbeans.modules.java.source.matching.CopyFinder.checkListsWithMultistatementTrees(CopyFinder.java:741)
at 
org.netbeans.modules.java.source.matching.CopyFinder.checkLists(CopyFinder.java:627)
at 
org.netbeans.modules.java.source.matching.CopyFinder.visitMethodInvocation(CopyFinder.java:618)
at 
org.netbeans.modules.java.source.matching.CopyFinder.visitMethodInvocation(CopyFinder.java:116)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1776)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
at 
org.netbeans.modules.java.source.matching.CopyFinder.doSuperScan(CopyFinder.java:586)
at 
org.netbeans.modules.java.source.matching.CopyFinder.superScan(CopyFinder.java:578)
at 
org.netbeans.modules.java.source.matching.CopyFinder.scan(CopyFinder.java:473)
at 
org.netbeans.modules.java.source.matching.CopyFinder.scan(CopyFinder.java:314)
at 
org.netbeans.modules.java.source.matching.CopyFinder.internalComputeDuplicates(CopyFinder.java:181)
at org.netbeans.api.java.source.matching.Matcher.match(Matcher.java:177)
at 
org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.doComputeHints(HintsInvoker.java:540)
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:539)
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)





CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024. Cerner Limited, Registered in 
England no 2519305, Registered Office 37 North Wharf Road, London W2 1AF.

Reply via email to