Project: JDT
Bug 49772 Change method signature: remove unused imports [refactoring]
Reported: 2004-01-09 10:38:06 | Status: resolved fixed

M6 package org.eclipse.jdt.internal.corext.refactoring.base; import org.eclipse.core.runtime.IAdaptable; /** * A <code>RefactoringStatusContext<code> can be used to annotate a * {@link RefactoringStatusEntry} with additional information * typically presented in the UI. * * @since 3.0 */ public class RefactoringStatusContext { /** * Returns the element that corresponds directly to this context, * or <code>null</code> if there is no corresponding element. * <p> * For example, the corresponding element of a context for a problem * detected in an <code>IResource</code> would the the resource itself. * <p> * * @return the corresponding element, or <code>null</code> if none */ public IAdaptable getCorrespondingElement() { return null; } } Consider the code from above and change the signature of getCorrespondingElement to return Object. If you press preview you get an refactoring error telling me that the import isn't used. Since we already detect this case we should remove the import. I know that this might introduce inconsistencies with other refactorings but getting this error message is even worse.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ChangeSignature/canModify/A_testAll60_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeSignature/canModify/A_testImport07_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ChangeSignatureTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ChangeSignatureRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java