View | Details | Raw Unified | Return to bug 351410 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java (+8 lines)
Added Link Here
1
package p;
2
3
public class A {
4
	public String getName() // rename to getSomething()
5
	{
6
		return null;
7
	}
8
}
(-)a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java (+8 lines)
Added Link Here
1
package p;
2
3
public class A {
4
	public String getSomething() // rename to getSomething()
5
	{
6
		return null;
7
	}
8
}
(-)a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java (+17 lines)
Lines 517-526 Link Here
517
517
518
		assertEquals("was supposed to pass", null, performRefactoring(refactoring));
518
		assertEquals("was supposed to pass", null, performRefactoring(refactoring));
519
		assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
519
		assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
520
	}
520
	}
521
521
522
	public void test41() throws Exception { // test for bug 351410
523
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), "A");
524
		IMethod method= cu.getType("A").getMethod("getName", new String[0]);
525
526
		final RenameJavaElementDescriptor descriptor= RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
527
		descriptor.setJavaElement(method);
528
		descriptor.setNewName("getSomething");
529
		descriptor.setUpdateReferences(true);
530
		final RefactoringStatus status= new RefactoringStatus();
531
		final Refactoring refactoring= descriptor.createRefactoring(status);
532
		assertNotNull("Refactoring should not be null", refactoring);
533
		assertTrue("status should be ok", status.isOK());
534
535
		assertEquals("was supposed to pass", null, performRefactoring(refactoring));
536
		assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
537
	}
538
522
	//anonymous inner class
539
	//anonymous inner class
523
	public void testAnon0() throws Exception{
540
	public void testAnon0() throws Exception{
524
		helper2();
541
		helper2();
525
	}
542
	}
526
543
(-)a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameMethodProcessor.java (-1 / +1 lines)
Lines 454-464 Link Here
454
	protected final IJavaSearchScope createRefactoringScope() throws CoreException {
454
	protected final IJavaSearchScope createRefactoringScope() throws CoreException {
455
		return createRefactoringScope(fMethod);
455
		return createRefactoringScope(fMethod);
456
	}
456
	}
457
	//TODO: shouldn't scope take all ripple methods into account?
457
	//TODO: shouldn't scope take all ripple methods into account?
458
	protected static final IJavaSearchScope createRefactoringScope(IMethod method) throws CoreException {
458
	protected static final IJavaSearchScope createRefactoringScope(IMethod method) throws CoreException {
459
		return RefactoringScopeFactory.create(method, true, false);
459
		return RefactoringScopeFactory.create(method, true, true);
460
	}
460
	}
461
461
462
	private SearchPattern createOccurrenceSearchPattern() {
462
	private SearchPattern createOccurrenceSearchPattern() {
463
		HashSet<IMethod> methods= new HashSet<IMethod>(fMethodsToRename);
463
		HashSet<IMethod> methods= new HashSet<IMethod>(fMethodsToRename);
464
		methods.add(fMethod);
464
		methods.add(fMethod);
(-)a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java (-1 / +1 lines)
Lines 347-357 Link Here
347
347
348
		int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE;
348
		int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE;
349
		int matchRule= SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE;
349
		int matchRule= SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE;
350
		SearchPattern pattern= SearchPattern.createPattern(fMethod, limitTo, matchRule);
350
		SearchPattern pattern= SearchPattern.createPattern(fMethod, limitTo, matchRule);
351
		SearchParticipant[] participants= SearchUtils.getDefaultSearchParticipants();
351
		SearchParticipant[] participants= SearchUtils.getDefaultSearchParticipants();
352
		IJavaSearchScope scope= RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaProject(), IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES);
352
		IJavaSearchScope scope= RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaProject(), IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES);
353
		MethodRequestor requestor= new MethodRequestor();
353
		MethodRequestor requestor= new MethodRequestor();
354
		SearchEngine searchEngine= owner != null ? new SearchEngine(owner) : new SearchEngine();
354
		SearchEngine searchEngine= owner != null ? new SearchEngine(owner) : new SearchEngine();
355
355
356
		searchEngine.search(pattern, participants, scope, requestor, monitor);
356
		searchEngine.search(pattern, participants, scope, requestor, monitor);
357
	}
357
	}

Return to bug 351410