Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 236881 Details for
Bug 99622
[rename] Rename method misses ambiguously overridden method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
partial fix
eclipse.jdt.ui.99622-2.patch (text/plain), 26.86 KB, created by
Nikolay Metchev
on 2013-10-25 06:03:42 EDT
(
hide
)
Description:
partial fix
Filename:
MIME Type:
Creator:
Nikolay Metchev
Created:
2013-10-25 06:03:42 EDT
Size:
26.86 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java >new file mode 100644 >index 0000000..ab751ae >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java >@@ -0,0 +1,16 @@ >+//can rename A.m to k >+package p; >+interface I { >+ >+} >+class B<T, K extends I> { >+ void m(T t) { >+ } >+ void m(K t) { >+ } >+} >+class A extends B<I, I> { >+ @Override >+ void m(I i) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java >new file mode 100644 >index 0000000..192c543 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java >@@ -0,0 +1,16 @@ >+//can rename A.m to k >+package p; >+interface I { >+ >+} >+class B<T, K extends I> { >+ void k(T t) { >+ } >+ void k(K t) { >+ } >+} >+class A extends B<I, I> { >+ @Override >+ void k(I i) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java >new file mode 100644 >index 0000000..3f7c770 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java >@@ -0,0 +1,16 @@ >+//can rename A.m(T) to k >+package p; >+interface I { >+ >+} >+class A<T, K extends I> { >+ void m(T t) { >+ } >+ void m(K t) { >+ } >+} >+class B extends A<I, I> { >+ @Override >+ void m(I i) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java >new file mode 100644 >index 0000000..fa2814b >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java >@@ -0,0 +1,16 @@ >+//can rename A.m(T) to k >+package p; >+interface I { >+ >+} >+class A<T, K extends I> { >+ void k(T t) { >+ } >+ void k(K t) { >+ } >+} >+class B extends A<I, I> { >+ @Override >+ void k(I i) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >index 4310a79..5f0acb8 100644 >--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >@@ -1,14 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.ui.tests.refactoring; > > import junit.framework.Test; > import junit.framework.TestSuite; >@@ -63,10 +64,11 @@ > suite.addTest(RenameStaticMethodTests.suite()); > suite.addTest(RenameParametersTests.suite()); > suite.addTest(MoveInstanceMethodTests.suite()); > suite.addTest(IntroduceIndirectionTests.suite()); > suite.addTest(IntroduceIndirectionTests17.suite()); >+ suite.addTest(RippleMethodFinderTests.suite()); > > //--types > suite.addTest(RenameTypeTests.suite()); > suite.addTest(RenameTypeParameterTests.suite()); > suite.addTest(ChangeTypeRefactoringTests.suite()); >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java >index d79bd26..b8f9c98 100644 >--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java >@@ -1,14 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.ui.tests.refactoring; > > import junit.framework.Test; > import junit.framework.TestSuite; >@@ -517,10 +518,18 @@ > > assertEquals("was supposed to pass", null, performRefactoring(refactoring)); > assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource()); > } > >+ public void test41() throws Exception { >+ helper2_0("m", "k", new String[] { "QI;" }); >+ } >+ >+// public void test42() throws Exception { >+// helper2_0("m", "k", new String[] { "QT;" }); >+// } >+ > //anonymous inner class > public void testAnon0() throws Exception{ > helper2(); > } > >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java >index 0cd527f..4b61700 100644 >--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java >@@ -1,19 +1,18 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.ui.tests.refactoring; > >-import java.io.IOException; >-import java.io.InputStream; > import java.util.ArrayList; > import java.util.List; > > import junit.framework.Test; > import junit.framework.TestSuite; >@@ -21,19 +20,15 @@ > import org.eclipse.core.runtime.NullProgressMonitor; > > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IMethod; >-import org.eclipse.jdt.core.IPackageFragment; > > import org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2; > >-import org.eclipse.jdt.ui.tests.refactoring.infra.AbstractCUTestCase; >-import org.eclipse.jdt.ui.tests.refactoring.infra.RefactoringTestPlugin; > >- >-public class RippleMethodFinderTests extends AbstractCUTestCase { >+public class RippleMethodFinderTests extends RefactoringTest { > > private static final Class clazz= RippleMethodFinderTests.class; > private static final String REFACTORING_PATH= "RippleMethodFinder/"; > private static final String TARGET= "/*target*/"; > private static final String RIPPLE= "/*ripple*/"; >@@ -52,18 +47,17 @@ > > public static Test setUpTest(Test someTest) { > return new RefactoringTestSetup(someTest); > } > >- protected InputStream getFileInputStream(String fileName) throws IOException { >- return RefactoringTestPlugin.getDefault().getTestResourceStream(fileName); >+ @Override >+ protected String createTestFileName(String cuName, String infix) { >+ return getTestPath() + "/RippleMethodFinder/" + cuName + ".java"; > } > > private void perform() throws Exception { >- IPackageFragment pack= RefactoringTestSetup.getPackageP(); >- String name= adaptName("A_" + getName()); >- ICompilationUnit cu= createCU(pack, name, getFileInputStream(getResourceLocation() + "/" + name)); >+ ICompilationUnit cu= createCUfromTestFile(getPackageP(), "A_" + getName()); > > String contents= cu.getBuffer().getContents(); > > IJavaElement[] elements= cu.codeSelect(contents.indexOf(TARGET) + TARGET.length(), 0); > assertEquals(1, elements.length); >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java >index 5b773e0..9e78d11 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java >@@ -1,14 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.internal.corext.refactoring.rename; > > import java.util.Arrays; > import java.util.HashSet; >@@ -43,22 +44,20 @@ > import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; > > > public class RenameVirtualMethodProcessor extends RenameMethodProcessor { > >- private IMethod fOriginalMethod; > private boolean fActivationChecked; > private ITypeHierarchy fCachedHierarchy= null; > > /** > * Creates a new rename method processor. > * > * @param method the method > */ > public RenameVirtualMethodProcessor(IMethod method) { > super(method); >- fOriginalMethod= getMethod(); > } > > /** > * Creates a new rename method processor from arguments > * >@@ -68,11 +67,10 @@ > */ > public RenameVirtualMethodProcessor(IMethod method, JavaRefactoringArguments arguments, RefactoringStatus status) { > this(method); > RefactoringStatus initializeStatus= initialize(arguments); > status.merge(initializeStatus); >- fOriginalMethod= getMethod(); > } > > /* > * int. not javadoc'd > * >@@ -81,18 +79,13 @@ > * methods. > * > */ > RenameVirtualMethodProcessor(IMethod topLevel, IMethod[] ripples, TextChangeManager changeManager, ITypeHierarchy hierarchy, GroupCategorySet categorySet) { > super(topLevel, changeManager, categorySet); >- fOriginalMethod= getMethod(); > fActivationChecked= true; // is top level > fCachedHierarchy= hierarchy; // may be null > setMethodsToRename(ripples); >- } >- >- public IMethod getOriginalMethod() { >- return fOriginalMethod; > } > > private ITypeHierarchy getCachedHierarchy(IType declaring, IProgressMonitor monitor) throws JavaModelException { > if (fCachedHierarchy != null && declaring.equals(fCachedHierarchy.getType())) > return fCachedHierarchy; >@@ -114,23 +107,11 @@ > return result; > try{ > monitor.beginTask("", 3); //$NON-NLS-1$ > if (!fActivationChecked) { > // the following code may change the method to be changed. >- IMethod method= getMethod(); >- fOriginalMethod= method; >- >- ITypeHierarchy hierarchy= null; >- IType declaringType= method.getDeclaringType(); >- if (!declaringType.isInterface()) >- hierarchy= getCachedHierarchy(declaringType, new SubProgressMonitor(monitor, 1)); >- >- IMethod topmost= getMethod(); >- if (MethodChecks.isVirtual(topmost)) >- topmost= MethodChecks.getTopmostMethod(getMethod(), hierarchy, monitor); >- if (topmost != null) >- initialize(topmost); >+ initialize(getMethod()); > fActivationChecked= true; > } > } finally{ > monitor.done(); > } >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java >index 0657e8c..6aaf46f 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java >@@ -1,14 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.internal.corext.refactoring.rename; > > import java.util.ArrayList; > import java.util.Arrays; >@@ -24,11 +25,10 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.core.runtime.SubProgressMonitor; > >-import org.eclipse.jdt.core.IMember; > import org.eclipse.jdt.core.IMethod; > import org.eclipse.jdt.core.IRegion; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.ITypeHierarchy; > import org.eclipse.jdt.core.JavaCore; >@@ -50,11 +50,11 @@ > public class RippleMethodFinder2 { > > private final IMethod fMethod; > private List<IMethod> fDeclarations; > private ITypeHierarchy fHierarchy; >- private Map<IType, IMethod> fTypeToMethod; >+ private MultiMap<IType, IMethod> fTypeToMethod; > private Set<IType> fRootTypes; > private MultiMap<IType, IType> fRootReps; > private Map<IType, ITypeHierarchy> fRootHierarchies; > private UnionFind fUnionFind; > >@@ -74,10 +74,14 @@ > collection.add(value); > } > > public Collection<V> get(K key) { > return fImplementation.get(key); >+ } >+ >+ public Set<K> keySet() { >+ return fImplementation.keySet(); > } > } > private static class UnionFind { > HashMap<IType, IType> fElementToRepresentative= new HashMap<IType, IType>(); > >@@ -220,11 +224,11 @@ > List<IType> relatedTypes= partitioning.get(methodTypeRep); > boolean hasRelatedInterfaces= false; > List<IMethod> relatedMethods= new ArrayList<IMethod>(); > for (Iterator<IType> iter= relatedTypes.iterator(); iter.hasNext();) { > IType relatedType= iter.next(); >- relatedMethods.add(fTypeToMethod.get(relatedType)); >+ relatedMethods.addAll(fTypeToMethod.get(relatedType)); > if (relatedType.isInterface()) > hasRelatedInterfaces= true; > } > > //Definition: An alien type is a type that is not a related type. The set of >@@ -268,22 +272,24 @@ > HashSet<IType> marriedAlienTypeReps= new HashSet<IType>(); > for (Iterator<IType> iter= alienTypes.iterator(); iter.hasNext();) { > if (pm.isCanceled()) > throw new OperationCanceledException(); > IType alienType= iter.next(); >- IMethod alienMethod= fTypeToMethod.get(alienType); >- ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1)); >- if (hierarchy == null) >- hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1)); >- IType[] allSubtypes= hierarchy.getAllSubtypes(alienType); >- for (int i= 0; i < allSubtypes.length; i++) { >- IType subtype= allSubtypes[i]; >- if (relatedSubTypes.contains(subtype)) { >- if (JavaModelUtil.isVisibleInHierarchy(alienMethod, subtype.getPackageFragment())) { >- marriedAlienTypeReps.add(fUnionFind.find(alienType)); >- } else { >- // not overridden >+ Collection<IMethod> alienMethods= fTypeToMethod.get(alienType); >+ for (IMethod alienMethod : alienMethods) { >+ ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1)); >+ if (hierarchy == null) >+ hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1)); >+ IType[] allSubtypes= hierarchy.getAllSubtypes(alienType); >+ for (int i= 0; i < allSubtypes.length; i++) { >+ IType subtype= allSubtypes[i]; >+ if (relatedSubTypes.contains(subtype)) { >+ if (JavaModelUtil.isVisibleInHierarchy(alienMethod, subtype.getPackageFragment())) { >+ marriedAlienTypeReps.add(fUnionFind.find(alienType)); >+ } else { >+ // not overridden >+ } > } > } > } > } > >@@ -293,11 +299,11 @@ > for (Iterator<IType> iter= marriedAlienTypeReps.iterator(); iter.hasNext();) { > IType marriedAlienTypeRep= iter.next(); > List<IType> marriedAlienTypes= partitioning.get(marriedAlienTypeRep); > for (Iterator<IType> iterator= marriedAlienTypes.iterator(); iterator.hasNext();) { > IType marriedAlienInterfaceType= iterator.next(); >- relatedMethods.add(fTypeToMethod.get(marriedAlienInterfaceType)); >+ relatedMethods.addAll(fTypeToMethod.get(marriedAlienInterfaceType)); > } > alienTypes.removeAll(marriedAlienTypes); //not alien any more > relatedTypesToProcess.addAll(marriedAlienTypes); //process freshly married types again > } > } >@@ -343,11 +349,11 @@ > fDeclarationToMatch.put(method, match); > } > } > } > >- int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE; >+ int limitTo= IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE; > int matchRule= SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE; > SearchPattern pattern= SearchPattern.createPattern(fMethod, limitTo, matchRule); > SearchParticipant[] participants= SearchUtils.getDefaultSearchParticipants(); > IJavaSearchScope scope= RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaProject(), IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES); > MethodRequestor requestor= new MethodRequestor(); >@@ -364,11 +370,11 @@ > } > fHierarchy= JavaCore.newTypeHierarchy(region, owner, pm); > } > > private void createTypeToMethod() { >- fTypeToMethod= new HashMap<IType, IMethod>(); >+ fTypeToMethod= new MultiMap<IType, IMethod>(); > for (Iterator<IMethod> iter= fDeclarations.iterator(); iter.hasNext();) { > IMethod declaration= iter.next(); > fTypeToMethod.put(declaration.getDeclaringType(), declaration); > } > } >@@ -402,19 +408,21 @@ > if (superRep == null) { > //Type doesn't declare method, but maybe supertypes? > uniteWithSupertypes(anchor, supertype); > } else { > //check whether method in supertype is really overridden: >- IMember superMethod= fTypeToMethod.get(supertype); >- if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) { >- IType rep= fUnionFind.find(anchor); >- fUnionFind.union(rep, superRep); >- // current type is no root anymore >- fRootTypes.remove(anchor); >- uniteWithSupertypes(supertype, supertype); >- } else { >- //Not overridden -> overriding chain ends here. >+ Collection<IMethod> superMethods= fTypeToMethod.get(supertype); >+ for (IMethod superMethod : superMethods) { >+ if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) { >+ IType rep= fUnionFind.find(anchor); >+ fUnionFind.union(rep, superRep); >+ // current type is no root anymore >+ fRootTypes.remove(anchor); >+ uniteWithSupertypes(supertype, supertype); >+ } else { >+ //Not overridden -> overriding chain ends here. >+ } > } > } > } > } > } >diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java >deleted file mode 100644 >index 7b45f49..0000000 >--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java >+++ /dev/null >@@ -1,72 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jdt.internal.ui.refactoring.reorg; >- >-import org.eclipse.swt.widgets.Shell; >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.NullProgressMonitor; >- >-import org.eclipse.jface.dialogs.MessageDialog; >- >-import org.eclipse.ltk.core.refactoring.Refactoring; >-import org.eclipse.ltk.core.refactoring.RefactoringStatus; >- >-import org.eclipse.jdt.core.IMethod; >- >-import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages; >-import org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor; >-import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; >-import org.eclipse.jdt.internal.corext.util.Messages; >- >-import org.eclipse.jdt.ui.JavaElementLabels; >- >-public class RenameMethodUserInterfaceStarter extends RenameUserInterfaceStarter { >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter#activate(org.eclipse.jdt.internal.corext.refactoring.base.Refactoring, org.eclipse.swt.widgets.Shell) >- */ >- @Override >- public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { >- RenameVirtualMethodProcessor processor= (RenameVirtualMethodProcessor)refactoring.getAdapter(RenameVirtualMethodProcessor.class); >- if (processor != null) { >- RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor()); >- if (!status.hasFatalError()) { >- IMethod method= processor.getMethod(); >- if (!method.equals(processor.getOriginalMethod())) { >- String message= null; >- if (method.getDeclaringType().isInterface()) { >- message= Messages.format( >- RefactoringCoreMessages.MethodChecks_implements, >- new String[]{ >- JavaElementUtil.createMethodSignature(method), >- JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)}); >- } else { >- message= Messages.format( >- RefactoringCoreMessages.MethodChecks_overrides, >- new String[]{ >- JavaElementUtil.createMethodSignature(method), >- JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)}); >- } >- message= Messages.format( >- ReorgMessages.RenameMethodUserInterfaceStarter_message, >- message); >- if (!MessageDialog.openQuestion(parent, >- ReorgMessages.RenameMethodUserInterfaceStarter_name, >- message)) { >- return false; >- } >- } >- } >- } >- return super.activate(refactoring, parent, saveMode); >- } >-} >diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java >index fda401c..e410f2b 100644 >--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java >+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java >@@ -1,14 +1,15 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Nikolay Metchev <nikolaymetchev@gmail.com> - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 > *******************************************************************************/ > package org.eclipse.jdt.internal.ui.refactoring.reorg; > > import org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor; > import org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor; >@@ -38,10 +39,10 @@ > put(RenameCompilationUnitProcessor.class, RenameUserInterfaceStarter.class, RenameCuWizard.class); > put(RenameTypeProcessor.class, RenameUserInterfaceStarter.class, RenameTypeWizard.class); > put(RenameFieldProcessor.class, RenameUserInterfaceStarter.class, RenameFieldWizard.class); > put(RenameEnumConstProcessor.class, RenameUserInterfaceStarter.class, RenameEnumConstWizard.class); > put(RenameTypeParameterProcessor.class, RenameUserInterfaceStarter.class, RenameTypeParameterWizard.class); >- put(RenameNonVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class); >- put(RenameVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class); >+ put(RenameNonVirtualMethodProcessor.class, RenameUserInterfaceStarter.class, RenameMethodWizard.class); >+ put(RenameVirtualMethodProcessor.class, RenameUserInterfaceStarter.class, RenameMethodWizard.class); > put(RenameLocalVariableProcessor.class, RenameUserInterfaceStarter.class, RenameLocalVariableWizard.class); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 99622
:
236879
|
236881
|
236949