| Summary: | [introduce parameter] IntroduceParameterRefactoring wrong assurance ICompilationUnit => IMethod | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Sergo <sergei.ikkert> |
| Component: | UI | Assignee: | Dani Megert <daniel_megert> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert |
| Version: | 3.7 | ||
| Target Milestone: | 3.7 M2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Moving to JDT/UI. As you notice, the refactoring takes the CU. Why don't you simply pass the CU? (In reply to comment #2) > As you notice, the refactoring takes the CU. Why don't you simply pass the CU? Because you get cast exceptions see fSourceCU = ((IMethods) element). getCompilationUnit (); Ah, right. I see it now. Fixed in IntroduceParameterRefactoring rev. 1.91. Verified in I20100914-0100. |
Build Identifier: M20090917-0800 I'm trying to create a refactoring using RefactoringDescriptor class. I'm generate the necessary arguments of the argument Map<String, String> to get an instance of the class "RefactoringDescriptor". Then a create refactoring object, that already parametrezed. Here I land in the method "private RefactoringStatus initialize(JavaRefactoringArguments arguments)„ of the class org.eclipse.jdt.internal.corext.refactoring.code.IntroduceParameterRefactoring. In this method, at line 564 is the wrong test, see Source: if (element == null | |! element.exists () | | element.getElementType ()! = IJavaElement.COMPILATION_UNIT) JavaRefactoringDescriptorUtil.createInputFatalStatus return (element getName (), IJavaRefactorings.INTRODUCE_PARAMETER); else fSourceCU = ((IMethods) element). getCompilationUnit (); In the "if" question is assured that variable is to be "element" ICompilationUnit type. Is expected, but IMethods! Reproducible: Always Steps to Reproduce: 1.Try to create an Refactoring using LTK API. Something like that! 2. public Refactoring createRefactoring(String project, String description, String comment) throws CoreException { final JavaRefactoringDescriptor descriptor = (JavaRefactoringDescriptor) RefactoringCore .getRefactoringContribution( IJavaRefactorings.INTRODUCE_PARAMETER) .createDescriptor(IJavaRefactorings.INTRODUCE_PARAMETER, project, description, comment, getAttributes(), getFlags()); Assert.isNotNull(descriptor); return descriptor.createRefactoring(descriptor.validateDescriptor()); } 3.