Community
Participate
Working Groups
Discovered during indexing the built Mozilla project in Linux. NPE caused by the file /home/dsteffle/mozilla-1_7_5/mozilla/xpcom/ds/nsStringEnumerator.cpp during a call to CPPMethod#getVisibility() with CPPASTQualifiedName==nsStringEnumerator::GetNext java.lang.NullPointerException at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod.getVisibility(CPPMethod.java:143) at org.eclipse.cdt.internal.core.index.domsourceindexer.IndexVisitorUtil.getModifiers(IndexVisitorUtil.java:61) at org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.processNameBinding(CPPGenerateIndexVisitor.java:296) at org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.processName(CPPGenerateIndexVisitor.java:169) at org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.visit(CPPGenerateIndexVisitor.java:112) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName.accept(CPPASTName.java:90) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName.accept(CPPASTQualifiedName.java:175) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept(CPPASTDeclarator.java:126) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition.accept(CPPASTFunctionDefinition.java:92) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit.accept(CPPASTTranslationUnit.java:520) at org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner.indexFile(DOMSourceIndexerRunner.java:133) at org.eclipse.cdt.internal.core.index.domsourceindexer.AbstractIndexerRunner.index(AbstractIndexerRunner.java:76) at org.eclipse.cdt.internal.core.index.cindexstorage.Index.add(Index.java:110) at org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddCompilationUnitToIndex.indexDocument(DOMAddCompilationUnitToIndex.java:29) at org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddFileToIndex.execute(DOMAddFileToIndex.java:60) at org.eclipse.cdt.internal.core.search.processing.JobManager.run(JobManager.java:466) at java.lang.Thread.run(Thread.java:595)
Can this be a candidate for RC2?
Would it be ok to have CPPMethod#getVisibility() return ICPPASTVisibilityLabel.v_private if the declaration for the CPPMethod is null? The declaration is null because getPrimaryDeclaration() returns null since declarations==null and no member in the scope has the same binding as the CPPMethod. Or would it be better to troubleshoot this further since this should probably never happen anyways?
troubleshoot to find the scenario to see if it is preventable. implement your solution (returning private) irregardless of the scenario.
Created attachment 24430 [details] fix for this PR The reason why getPrimaryDeclaration() returns null still needs to be investigated.
done. though, if we can, we check the containing class and return public if its a struct.