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

Bug 325542

Summary: [exceptions] NPE on null scope in LocalVariableBinding#getScopeKey()
Product: [WebTools] JSDT Reporter: Nitin Dahyabhai <thatnitind>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2.2Flags: thatnitind: review+
Target Milestone: 3.2.5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch none

Description Nitin Dahyabhai CLA 2010-09-17 01:07:42 EDT
!ENTRY org.eclipse.wst.jsdt.ui 4 0 2010-09-17 01:02:53.265
!MESSAGE Error in JSDT Core during reconcile
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LocalVariableBinding.getScopeKey(LocalVariableBinding.java:161)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LocalVariableBinding.computeUniqueKey(LocalVariableBinding.java:103)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.Binding.computeUniqueKey(Binding.java:52)
	at org.eclipse.wst.jsdt.core.dom.VariableBinding.getKey(VariableBinding.java:103)
	at org.eclipse.wst.jsdt.core.dom.DefaultBindingResolver.resolveVariable(DefaultBindingResolver.java:1401)
	at org.eclipse.wst.jsdt.core.dom.VariableDeclaration.resolveBinding(VariableDeclaration.java:198)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:639)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:363)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1018)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1480)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1050)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1034)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1483)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1861)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1471)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:2236)
	at org.eclipse.wst.jsdt.core.dom.ASTConverter.convert(ASTConverter.java:1151)
	at org.eclipse.wst.jsdt.core.dom.AST.convertCompilationUnit(AST.java:264)
	at org.eclipse.wst.jsdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:214)
	at org.eclipse.wst.jsdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:96)
	at org.eclipse.wst.jsdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:742)
	at org.eclipse.wst.jsdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
	at org.eclipse.wst.jsdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1177)
	at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:95)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:76)
	at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:143)
	at org.eclipse.wst.jsdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:85)
	at org.eclipse.wst.jsdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
	at org.eclipse.wst.jsdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:371)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
Comment 1 Nitin Dahyabhai CLA 2010-09-17 01:12:00 EDT
According to bug 185129, a null scope is fine.
Comment 2 Chris Jaun CLA 2011-06-30 13:40:06 EDT
Created attachment 198923 [details]
patch

Formatting makes the patch a bit hard to read....the only change is moving the call to getScopeKey inside the "if" that checks if scope is not null.
Comment 3 Nitin Dahyabhai CLA 2011-07-14 02:16:40 EDT
Committed for 3.2.5 and HEAD.