Community
Participate
Working Groups
Build Identifier: 20100917-0705 In a unit test I'm parsing the string work.cpu_types.status_value'(work.cpu_types.fetch) It fails due to a NPE in Thread [main] (Suspended (exception NullPointerException)) NodeModelBuilder.replaceWithoutChildren(AbstractNode, AbstractNode) line: 316 NodeModelBuilder.replace(AbstractNode, AbstractNode) line: 276 NodeModelBuilder.compressAndReturnParent(ICompositeNode) line: 194 InternalVHDLLangParser(AbstractInternalAntlrParser).parse(String) line: 548 VHDLLangParser(AbstractAntlrParser).doParse(String, CharStream, NodeModelBuilder) line: 101 VHDLLangParser(AbstractAntlrParser).parse(String, CharStream) line: 84 VHDLLangParser(AbstractAntlrParser).parse(ParserRule, Reader) line: 115 ParseExpressionTest(BaseVhdlLexerParserTest).getParseResult(Reader, ParserRule) line: 147 ParseExpressionTest(BaseVhdlLexerParserTest).checkParsing(Reader, ParserRule) line: 156 ParseExpressionTest(BaseVhdlLexerParserTest).checkParsing(String, ParserRule) line: 171 ParseExpressionTest.testParseQualifiedExpression() line: 88 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 616 ParseExpressionTest(TestCase).runTest() line: 168 ParseExpressionTest(TestCase).runBare() line: 134 TestResult$1.protect() line: 110 TestResult.runProtected(Test, Protectable) line: 128 TestResult.run(TestCase) line: 113 ParseExpressionTest(TestCase).run(TestResult) line: 124 TestSuite.runTest(Test, TestResult) line: 232 TestSuite.run(TestResult) line: 227 JUnit38ClassRunner.run(RunNotifier) line: 83 JUnit4TestMethodReference(JUnit4TestReference).run(TestExecution) line: 49 TestExecution.run(ITestReference[]) line: 38 RemoteTestRunner.runTests(String[], String, TestExecution) line: 467 RemoteTestRunner.runTests(TestExecution) line: 683 RemoteTestRunner.run() line: 390 RemoteTestRunner.main(String[]) line: 197 The offending code seems to be protected void replaceWithoutChildren(AbstractNode oldNode, AbstractNode newNode) { newNode.basicSetParent(oldNode.basicGetParent()); if ((oldNode.basicGetParent()).basicGetFirstChild() == oldNode) { (newNode.basicGetParent()).basicSetFirstChild(newNode); } if (oldNode.basicGetNextSibling() == oldNode) { newNode.basicSetNextSibling(newNode); } else { newNode.basicSetNextSibling(oldNode.basicGetNextSibling()); newNode.basicGetNextSibling().basicSetPreviousSibling(newNode); } if (oldNode.getPreviousSibling() == oldNode) { newNode.basicSetPreviousSibling(newNode); } else { newNode.basicSetPreviousSibling(oldNode.basicGetPreviousSibling()); newNode.basicGetPreviousSibling().basicSetNextSibling(newNode); } } In the first if-statement the oldNode.basicGetParent () is null. Reproducible: Always
I'm using the nightly build 2.0.0.v201101251647. My other 8000+ parser tests succeed.
Mark, could you please provide a grammar that allows to reproduce the issue? Thanks, Sebastian
Fixed. The NPE was actually caused by a previous NoSuchMethodException that was shadowed by the subsequent NPE.
Closing all bugs that were set to RESOLVED before Neon.0