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

Bug 423574

Summary: [1.8] UnsupportedOperationException with PolyTypeBinding on hover
Product: [Eclipse Project] JDT Reporter: Noopur Gupta <noopur_gupta>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: anchakrk, markus.kell.r, srikanth_sankaran
Version: 4.4   
Target Milestone: BETA J8   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 423585    

Description Noopur Gupta CLA 2013-12-09 05:44:08 EST
package test;

import java.util.function.Supplier;

public class Bug {

	private void fun1() {
		Runnable runnable = () -> { System.out.println("hi"); };
		fun2(() -> runnable); // Error
	}
	
	private void fun2(Object c) {}
}
--------------------------------------------------

The above code has error at the line with comment.
Hover over the opening parentheses of "fun2" invocation at the line with error. We get the following exception (org.eclipse.jdt.core.dom.TypeBinding#getQualifiedName should consider PolyTypeBinding):

java.lang.UnsupportedOperationException
	at org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding.getPackage(PolyTypeBinding.java:33)
	at org.eclipse.jdt.core.dom.TypeBinding.getQualifiedName(TypeBinding.java:814)
	at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getAccessorClassReference(NLSHintHelper.java:144)
	at org.eclipse.jdt.internal.ui.text.java.hover.NLSStringHover.internalGetHoverInfo(NLSStringHover.java:159)
	at org.eclipse.jdt.internal.ui.text.java.hover.NLSStringHover.getHoverInfo2(NLSStringHover.java:114)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:129)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:85)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)
Comment 1 ANIRBAN CHAKRABORTY CLA 2013-12-11 03:16:52 EST
Please refer to code patch uploaded in Bug 423584, which fixes the issue. Test upload to follow
Comment 2 Noopur Gupta CLA 2013-12-13 05:46:44 EST
Verified that the patch in bug 423582 comment #7 resolves the UOE issue.
Comment 3 Srikanth Sankaran CLA 2013-12-13 05:53:12 EST
Thanks Noopur.

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