Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321885

Summary: Invalid logic in at MethodBinding.canBeSeenBy(MethodBinding.java:256) resulting in NPE
Product: [WebTools] JSDT Reporter: Chris Jaun <cmjaun>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 Flags: thatnitind: review+
Version: 3.2.1   
Target Milestone: 3.2.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Chris Jaun CLA 2010-08-05 10:44:26 EDT
For the following code:

function someFunction() {

var subFunction = function() {
}
*
}

If you attempt content assist at the * you get a NPE.

Add a null check.
Comment 1 Chris Jaun CLA 2010-08-05 10:45:22 EDT
Created attachment 175947 [details]
patch
Comment 2 Chris Jaun CLA 2010-08-05 10:45:38 EDT
Add a null check.
Comment 3 Chris Jaun CLA 2010-08-05 13:31:33 EDT
java.lang.NullPointerException
    at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodBinding.canBeSeenBy(Unknown Source)
    at org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine.findLocalMethods(Unknown Source)
    at org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine.findVariablesAndMethods(Unknown Source)
    at org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine.complete(Unknown Source)
    at org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine.complete(Unknown Source)
    at org.eclipse.wst.jsdt.internal.core.Openable.codeComplete(Unknown Source)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnit.codeComplete(Unknown Source)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnit.codeComplete(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(Unknown Source)
    at org.eclipse.wst.jsdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(Unknown Source)
    at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(Unknown Source)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(Unknown Source)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(Unknown Source)
    at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(Unknown Source)
Comment 4 Chris Jaun CLA 2010-08-05 14:46:46 EDT
Checked into 3.2.2. and HEAD.