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

Bug 320511

Summary: [infer type arguments] NPE in InferTypeArgumentsConstraintsSolver#getNonTaggingInterfaces()
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.7   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix none

Description Markus Keller CLA 2010-07-21 09:59:12 EDT
Created attachment 174852 [details]
Fix

I20100720-0800

NPE in InferTypeArgumentsConstraintsSolver#getNonTaggingInterfaces() when trying to infer type arguments of org.eclipse.jdt.ui:

Root exception:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver.getNonTaggingInterfaces(InferTypeArgumentsConstraintsSolver.java:358)
	at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver.chooseSingleType(InferTypeArgumentsConstraintsSolver.java:321)
	at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver.chooseTypes(InferTypeArgumentsConstraintsSolver.java:280)
	at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver.solveConstraints(InferTypeArgumentsConstraintsSolver.java:129)
	at org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsRefactoring.checkFinalConditions(InferTypeArgumentsRefactoring.java:235)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:85)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:121)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


Problem is that InferTypeArgumentsConstraintsSolver#getNonTaggingInterfaces() assumes that all types are from the same project. The code was stupid anyway (expensive AST parsing is not required at all), so the fix will also improve performance.
Comment 1 Markus Keller CLA 2010-07-21 11:04:54 EDT
Fixed in HEAD.