Bug 136016

Summary: [refactoring] CCE during Use Supertype refactoring
Product: [Eclipse Project] JDT Reporter: Tobias Widmer <tobias_widmer>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, Olivier_Thomann
Version: 3.2   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch and regression test none

Description Tobias Widmer CLA 2006-04-10 19:32:55 EDT
N20060407-0010

Steps to reproduce:
- Have org.eclipse.jface binary in workspace
- Open type TreeSelection
- Open outline
- Invoke Use Supertype Where Possible on TreeSelection in outline
- Select ITreeSelection
- Press Finish

-> CCE occurs:
Caused by: java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject
	at org.eclipse.jdt.core.dom.TypeBinding.getPackageFragment(TypeBinding.java:648)
	at org.eclipse.jdt.core.dom.TypeBinding.getClassFile(TypeBinding.java:130)
	at org.eclipse.jdt.core.dom.TypeBinding.getUnresolvedJavaElement(TypeBinding.java:483)
	at org.eclipse.jdt.core.dom.TypeBinding.getUnresolvedJavaElement(TypeBinding.java:408)
	at org.eclipse.jdt.core.dom.TypeBinding.getJavaElement(TypeBinding.java:401)
	at org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TypeEnvironment.createStandardType(TypeEnvironment.java:337)
	at org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TypeEnvironment.create(TypeEnvironment.java:197)
	at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor.solveSuperTypeConstraints(SuperTypeRefactoringProcessor.java:1068)
	at org.eclipse.jdt.internal.corext.refactoring.structure.UseSuperTypeProcessor.createChangeManager(UseSuperTypeProcessor.java:264)
	at org.eclipse.jdt.internal.corext.refactoring.structure.UseSuperTypeProcessor.checkFinalConditions(UseSuperTypeProcessor.java:165)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:174)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:118)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 1 Olivier Thomann CLA 2006-04-10 23:17:57 EDT
Jerome,

This is a new occurance of the problem Markus got last week.

Tobias, 
When I follow the steps, I select ITreeSelection, but nothing happens when I press OK (no Finish button).
I get "No possible update found" besides the ITreeSelection name.
Comment 2 Tobias Widmer CLA 2006-04-11 04:49:12 EDT
Olivier,

This is by design. If you have ie. jdt.core in the workspace and JFace as binary, there are no type occurrences of TreeSelection which could be updated.

Otherwise, if there are opportunities to replace TreeSelection by ITreeSelection, please file a bug against JDT UI.
Comment 3 Markus Keller CLA 2006-04-11 05:50:34 EDT
To reproduce, you also have to import org.eclipse.jdt.ui as source into your workspace (I got it in a clean N20060411-0010 with only these two projects).
Comment 4 Jerome Lanneluc CLA 2006-04-11 10:17:47 EDT
*** Bug 135573 has been marked as a duplicate of this bug. ***
Comment 5 Jerome Lanneluc CLA 2006-04-11 11:24:30 EDT
Created attachment 38291 [details]
Proposed patch and regression test
Comment 6 Philipe Mulet CLA 2006-04-11 13:03:08 EDT
+1 for 3.2RC1
Comment 7 Jerome Lanneluc CLA 2006-04-11 13:15:16 EDT
Released patch and regression test
Comment 8 David Audel CLA 2006-04-13 12:44:32 EDT
Verified for 3.2 RC1 using build I20060413-0010