Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 378585 - NullPointerException in org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(char[][])
Summary: NullPointerException in org.eclipse.wst.jsdt.internal.compiler.lookup.Compila...
Status: CLOSED DUPLICATE of bug 359005
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5.1   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-05 12:50 EDT by Victor Rubezhny CLA
Modified: 2013-06-27 10:39 EDT (History)
1 user (show)

See Also:


Attachments
JS-File to reproduce the issue (7.34 KB, text/plain)
2012-05-05 12:54 EDT, Victor Rubezhny CLA
no flags Details
The patch fixes the issue (834 bytes, patch)
2012-05-05 13:16 EDT, Victor Rubezhny CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Rubezhny CLA 2012-05-05 12:50:11 EDT
Build Identifier: Build id: M20120208-0800

NullPointerException occures under certain circumstances when pointing a text cursor into a string value like the following 'print'.

See the stack trace:

!ENTRY org.eclipse.jface.text 4 0 2012-05-05 20:29:57.762
!MESSAGE Unexpected runtime error while computing a text hover
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:669)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:674)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:387)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:443)
	at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.accept(CompilationUnitProblemFinder.java:174)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForBinding(LookupEnvironment.java:279)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:132)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:766)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getResolvedType(LookupEnvironment.java:720)
	at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getJavaLangString(Scope.java:1745)
	at org.eclipse.wst.jsdt.core.dom.DefaultBindingResolver.resolveExpressionType(DefaultBindingResolver.java:604)
	at org.eclipse.wst.jsdt.core.dom.Expression.resolveTypeBinding(Expression.java:111)
	at org.eclipse.wst.jsdt.internal.corext.refactoring.nls.NLSHintHelper.getAccessorClassReference(NLSHintHelper.java:97)
	at org.eclipse.wst.jsdt.internal.ui.text.java.hover.NLSStringHover.getHoverInfo(NLSStringHover.java:96)
	at org.eclipse.wst.jsdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getHoverInfo2(AbstractJavaEditorTextHover.java:95)
	at org.eclipse.wst.jsdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:147)
	at org.eclipse.wst.jsdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:78)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)


Reproducible: Always

Steps to Reproduce:
1. Create a JavaScript project. Add the JS-file attached to the project and open it in JavaScript Editor
2. Find some String value in the text like 'print' and select it by clicking left mouse button.
3. Close the editor (the best chance to reproduce the issue is when the editor is just opened)
3. See the Error log.
Comment 1 Victor Rubezhny CLA 2012-05-05 12:54:03 EDT
Created attachment 215128 [details]
JS-File to reproduce the issue

JavaScript file to reproduce the issue is OverLibWS_print.js taken from issue #375703
Comment 2 Victor Rubezhny CLA 2012-05-05 13:16:18 EDT
Created attachment 215130 [details]
The patch fixes the issue

The patch just adds an additional check for null for classScope field of inferred type binding (if found in connectTypeHierarchy(char[][] typeNames) method).
Comment 3 Victor Rubezhny CLA 2012-05-12 17:58:29 EDT
Sorry, looks like a duplication of #359005
Comment 4 Victor Rubezhny CLA 2012-05-17 09:47:34 EDT
Comment on attachment 215130 [details]
The patch fixes the issue

Marking the patch as obsolete, since the double check for nulls doesn't solves the root problem. 

IMHO, this issue could be closed as duplicate of #359005. The only steps to reproduce could be used from this issue.
Comment 5 Chris Jaun CLA 2013-06-27 10:39:15 EDT

*** This bug has been marked as a duplicate of bug 359005 ***