Community
Participate
Working Groups
3.3M7 I20070503-1400 public class A { public static void main(String[] args) { method(5, 6); } public static void method(int x, int y) { System.out.println(x + ", " + y); } } Extract a parameter object class Point in a separate CU on x any y and name it point. The result is: public class A { public static void main(String[] args) { method(new Point(5, 6)); } public static void method(java.awt.Point point) { System.out.println(point.x + ", " + point.y); } } The method call no longer matches the signature, which now references java.awt.Point.
Created attachment 67952 [details] Some refactoring + better import of added Parameter
Please review
Javadoc in IDefaultValueAdvisor: don't write "returns" after @return ParameterObjectFactory: - Format new code (spaces around binary expressions, ...) - cuRewrite.getRoot().getPackage() is null in default package => NPE. Also check the rest of the method for problems with default package. I would just use ((IPackageFragment) cuRewrite.getCu().getParent()).getElementName() - Why do you need localContext? Can't you just call super.findInContext(..) again? Please add a test with a class in the default package. Rest looks OK.
Created attachment 68327 [details] Changes for Comment #3 The subclassing of the context was not necessary. It was a result from testing with a screwed up workspace and not reproducable.
patch is good
Please review the latest attachment
Created attachment 68399 [details] Updated Patch for default package tests java.awt.Point was not in RT.jar of RefactoringTestSetup thus resulting in a wrong green.
(In reply to comment #7) > Created an attachment (id=68399) [details] > Updated Patch for default package tests In addition to test updates, this patch adds a change in ParameterInfo, which is good for now, but should be fixed later. Add this comment to ParameterInfo.setNewTypeBinding(..) when releasing: //TODO: TypeContextChecker should not resolve such a parameter at all. // That would also make IProblemVerifier obsolete. Martin, do you approve the change in ParameterInfo?
approved, please release.
Released to HEAD.
verified in I20070527-0010