Bug 193529 - [refactoring] Move JDTRefactoringContribution.createRefactoring(RefactoringDescriptor) to org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringContribution
Summary: [refactoring] Move JDTRefactoringContribution.createRefactoring(RefactoringDe...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Karsten Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-06-20 10:45 EDT by Karsten Becker CLA
Modified: 2007-07-05 05:30 EDT (History)
2 users (show)

See Also:


Attachments
Move of method (4.52 KB, patch)
2007-06-20 10:48 EDT, Karsten Becker CLA
no flags Details | Diff
Updated Patch (118.62 KB, patch)
2007-06-21 15:13 EDT, Karsten Becker CLA
no flags Details | Diff
Updated Version (54.29 KB, patch)
2007-06-22 11:46 EDT, Karsten Becker CLA
no flags Details | Diff
Descriptor updates (443.40 KB, patch)
2007-06-27 06:30 EDT, Karsten Becker CLA
no flags Details | Diff
Missed some processors (476.39 KB, patch)
2007-06-27 06:53 EDT, Karsten Becker CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Becker CLA 2007-06-20 10:45:48 EDT
At the moment it is not possible to create an implementation of JavaRefactoringDescriptor that does not yield in a StackOverflow if the implementation of org.eclipse.ltk.core.refactoring.RefactoringContribution.createDescriptor(String, String, String, String, Map, int) returns a non JDTRefactoringDescriptor. The problem is caused by the fact that JavaRefactoringDescriptor.createRefactoring(RefactoringStatus) does not have the possibility to invoke the JDTRefactoringContribution.createRefactoring(RefactoringDescriptor) method. Instead a indirection is performed by first calling JDTRefactoringContribution.createDescriptor(String, String, String, String, Map, int) which always returns a JDTRefactoringDescriptor which then invokes the JDTRefactoringContribution.createRefactoring(RefactoringDescriptor).

At first, JDTRefactoringContribution.createDescriptor(String, String, String, String, Map, int) is meant to return a specialized Descriptor as documented in org.eclipse.jdt.core.refactoring.IJavaRefactorings.CHANGE_METHOD_SIGNATURE for example.

At second the transformation of the specialized descriptor into the general one (JDTRefactoringDescriptor) and then passed to the refactoring as RefactoringArguments loses a lot of useful information.

In a later step one might discuss to remove the IScriptableRefactoring interface as the Contribution has all information at hand to initialize the refactoring using the descriptor. Or even better, the refactoring is only invokeable using a descriptor. Using a descriptor in the constructor of a refactoring does not mean to perform all initializations in the constructor.

I will attach a patch for the move.
Comment 1 Karsten Becker CLA 2007-06-20 10:48:06 EDT
Created attachment 71900 [details]
Move of method

One might think about narrowing the RefactoringDescriptor to JavaRefactoringDescriptor
Comment 2 Martin Aeschlimann CLA 2007-06-20 12:04:50 EDT
patch released > 20070620
Comment 3 Martin Aeschlimann CLA 2007-06-20 16:59:12 EDT
reverted patch as rename tests are failing
Comment 4 Karsten Becker CLA 2007-06-21 15:13:35 EDT
Created attachment 72076 [details]
Updated Patch

Updated all Contributions to adapt descriptors to IScriptableRefactoring
Comment 5 Karsten Becker CLA 2007-06-22 11:46:35 EDT
Created attachment 72189 [details]
Updated Version

+Removed most uses of JDTRefactoringDescriptor
+Specialized Descriptors are used in most places
-Most Descriptors need a full implementation, I did what it took to make it run, but the descriptors are far from being perfect.
-Move/Copy stuff will be tricky to solve and is untouched by now. Propably another Bug for that would be useful.
Comment 6 Karsten Becker CLA 2007-06-22 11:50:03 EDT
the attached patch is incomplete will create a new one
Comment 7 Karsten Becker CLA 2007-06-27 06:30:54 EDT
Created attachment 72577 [details]
Descriptor updates

In this patch JDTRefactoringDescriptor has been completly eliminated. Only specialized descriptors are returned in any case.
Some functionality which was basically utility methods have been moved to a new class JavaRefactoringDescriptorUtility. This is the place where further helper methods should go to.
Comment 8 Karsten Becker CLA 2007-06-27 06:53:44 EDT
Created attachment 72580 [details]
Missed some processors
Comment 9 Martin Aeschlimann CLA 2007-06-28 08:49:11 EDT
patch released > 20070627
Comment 10 Karsten Becker CLA 2007-07-05 05:30:35 EDT
fixed