You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Scott Palmer <sw...@gmail.com> on 2020/06/06 18:44:09 UTC

NPE in Java parsing

Get this when the Ice starts up and opens my projects.  I’m not sure what project is causing it.  I am in the middle of porting some code from Go to Java and I have pasted Go code into Java source files, so there are tons of errors until I manually get to re-writing them.  Still, I would expect the parser to handing syntax errors gracefully. 

Given that the NPE seems to be inside JDK code, I can say that this is a NB bug, but I bring it to your attention here so that someone more familiar with the java source parsing can perhaps pass on a report to the JDK folks.

Regards,

Scott

java.lang.NullPointerException
	at jdk.compiler/com.sun.tools.javac.jvm.Code.typecode(Code.java:243)
	at jdk.compiler/com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:271)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:866)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:889)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitNewClass(Gen.java:1942)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1791)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:864)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1998)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1980)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:864)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1723)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1523)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:632)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:618)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:669)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1084)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:632)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:954)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:917)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:884)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2395)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:756)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1646)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$2.process(JavacTaskImpl.java:458)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$Filter.run(JavacTaskImpl.java:506)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.generate(JavacTaskImpl.java:461)
	at org.netbeans.modules.java.source.indexing.VanillaCompileWorker$2.run(VanillaCompileWorker.java:338)
	at org.netbeans.modules.java.source.parsing.FileManagerTransaction.runConcurrent(FileManagerTransaction.java:180)
[catch] at org.netbeans.modules.java.source.indexing.VanillaCompileWorker.compile(VanillaCompileWorker.java:325)
	at org.netbeans.modules.java.source.indexing.JavaCustomIndexer.index(JavaCustomIndexer.java:361)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$2.run(Indexable.java:138)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:136)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2750)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3300)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3255)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.scanFiles(RepositoryUpdater.java:3255)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FileListWork.getDone(RepositoryUpdater.java:3785)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
	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)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




RE: NPE in Java parsing

Posted by Eirik Bakke <eb...@ultorg.com>.
There are quite a few of these. It might be useful to make a copy of whichever Java file is triggering the error, and then carefully simplify it down until you have a minimal example that will trigger the example.

For example, here are some similar javac errors I've reported in the past:
https://issues.apache.org/jira/browse/NETBEANS-4384
https://issues.apache.org/jira/browse/NETBEANS-4296
https://issues.apache.org/jira/browse/NETBEANS-4180
https://issues.apache.org/jira/browse/NETBEANS-4179
https://issues.apache.org/jira/browse/NETBEANS-4095

(Your stack trace does not seem to be covered by any existing report, though--I searched JIRA for "Code.typecode" and found no results.)

-- Eirik

-----Original Message-----
From: Scott Palmer <sw...@gmail.com> 
Sent: Saturday, June 6, 2020 2:44 PM
To: Apache NetBeans <de...@netbeans.apache.org>
Subject: NPE in Java parsing

Get this when the Ice starts up and opens my projects.  I’m not sure what project is causing it.  I am in the middle of porting some code from Go to Java and I have pasted Go code into Java source files, so there are tons of errors until I manually get to re-writing them.  Still, I would expect the parser to handing syntax errors gracefully. 

Given that the NPE seems to be inside JDK code, I can say that this is a NB bug, but I bring it to your attention here so that someone more familiar with the java source parsing can perhaps pass on a report to the JDK folks.

Regards,

Scott

java.lang.NullPointerException
	at jdk.compiler/com.sun.tools.javac.jvm.Code.typecode(Code.java:243)
	at jdk.compiler/com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:271)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:866)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:889)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitNewClass(Gen.java:1942)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1791)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:864)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1998)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:1980)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:864)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1723)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1523)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:632)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:618)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:669)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1084)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1038)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:632)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:954)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:917)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:884)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
	at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2395)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:756)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1646)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$2.process(JavacTaskImpl.java:458)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$Filter.run(JavacTaskImpl.java:506)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.generate(JavacTaskImpl.java:461)
	at org.netbeans.modules.java.source.indexing.VanillaCompileWorker$2.run(VanillaCompileWorker.java:338)
	at org.netbeans.modules.java.source.parsing.FileManagerTransaction.runConcurrent(FileManagerTransaction.java:180)
[catch] at org.netbeans.modules.java.source.indexing.VanillaCompileWorker.compile(VanillaCompileWorker.java:325)
	at org.netbeans.modules.java.source.indexing.JavaCustomIndexer.index(JavaCustomIndexer.java:361)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$2.run(Indexable.java:138)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:275)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:136)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2750)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$800(RepositoryUpdater.java:2154)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2636)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2634)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:540)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2634)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3300)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$3.call(RepositoryUpdater.java:3255)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$4.run(RepositoryUpdater.java:2127)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2123)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runInContext(RepositoryUpdater.java:2104)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.access$1500(RepositoryUpdater.java:136)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.scanFiles(RepositoryUpdater.java:3255)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FileListWork.getDone(RepositoryUpdater.java:3785)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3420)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6183)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4300(RepositoryUpdater.java:5834)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2$1.run(RepositoryUpdater.java:6099)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6095)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6091)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6091)
	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)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists