Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rename of method named 'copy' freezes Eclipse #1192

Closed
jukzi opened this issue Feb 14, 2024 · 5 comments · Fixed by #1193
Closed

Refactor rename of method named 'copy' freezes Eclipse #1192

jukzi opened this issue Feb 14, 2024 · 5 comments · Fixed by #1193
Labels
bug Something isn't working

Comments

@jukzi
Copy link
Contributor

jukzi commented Feb 14, 2024

To reproduce:

  • Define a method: void copy() {}.
  • Rename it through refactoring.

Result:

  • Eclipse freezes.

It does not happen when the method has arguments.
It happens in both version 2023-03 and 2023-12.

Originally posted by @WJSchakel in eclipse-platform/eclipse.platform.ui#1675 (comment)

some sampling:
image

@jukzi
Copy link
Contributor Author

jukzi commented Feb 14, 2024

I can reproduce it in some projects, for example in the package org.eclipse.jdt.unittest.junit - but not in a trival project or package org.eclipse.jdt.ui.tests.refactoring.actions.

public class A {
	// refactor the name:
	void copy() {}
}

@jukzi
Copy link
Contributor Author

jukzi commented Feb 14, 2024

stacktrace:

Thread [ModalContext] (Suspended (breakpoint at line 686 in org.eclipse.core.runtime.Path))	
	org.eclipse.core.runtime.Path.equals(java.lang.Object) line: 686	
	org.eclipse.jdt.internal.core.JrtPackageFragmentRoot.equals(java.lang.Object) line: 118	
	org.eclipse.jdt.internal.core.JarPackageFragment(org.eclipse.jdt.internal.core.PackageFragment).equals(java.lang.Object) line: 188	
	org.eclipse.jdt.internal.core.ClassFile(org.eclipse.jdt.internal.core.AbstractClassFile).equals(java.lang.Object) line: 132	
	org.eclipse.jdt.internal.core.ResolvedBinaryType(org.eclipse.jdt.internal.core.JavaElement).equals(java.lang.Object) line: 189	
	org.eclipse.jdt.internal.core.ResolvedBinaryType(org.eclipse.jdt.internal.core.SourceRefElement).equals(java.lang.Object) line: 98	
	org.eclipse.jdt.internal.core.ResolvedBinaryType(org.eclipse.jdt.internal.core.BinaryType).equals(java.lang.Object) line: 174	
	java.util.HashMap<K,V>.getNode(java.lang.Object) line: 577	
	java.util.HashMap<K,V>.get(java.lang.Object) line: 556	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2$UnionFind.find(org.eclipse.jdt.core.IType) line: 103	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.uniteWithSupertypes(org.eclipse.jdt.core.IType, org.eclipse.jdt.core.IType) line: 519	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.uniteWithSupertypes(org.eclipse.jdt.core.IType, org.eclipse.jdt.core.IType) line: 532	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.uniteWithSupertypes(org.eclipse.jdt.core.IType, org.eclipse.jdt.core.IType) line: 532	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.createUnionFind() line: 506	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.findAllRippleMethods(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.jdt.core.WorkingCopyOwner) line: 223	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.getAllRippleMethods(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.jdt.core.WorkingCopyOwner) line: 188	
	org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.getRelatedMethods(org.eclipse.jdt.core.IMethod, org.eclipse.jdt.internal.corext.refactoring.base.ReferencesInBinaryContext, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.jdt.core.WorkingCopyOwner) line: 181	
	org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor).initializeMethodsToRename(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.jdt.internal.corext.refactoring.base.ReferencesInBinaryContext) line: 252	
	org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor).doCheckFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext) line: 394	
	org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor.doCheckFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext) line: 153	
	org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor).checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext) line: 51	
	org.eclipse.ltk.core.refactoring.participants.RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring).checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor) line: 227	
	org.eclipse.ltk.core.refactoring.participants.RenameRefactoring(org.eclipse.ltk.core.refactoring.Refactoring).checkAllConditions(org.eclipse.core.runtime.IProgressMonitor) line: 163	
	org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(org.eclipse.core.runtime.IProgressMonitor) line: 84	
	org.eclipse.jdt.internal.core.BatchOperation.executeOperation() line: 41	
	org.eclipse.jdt.internal.core.BatchOperation(org.eclipse.jdt.internal.core.JavaModelOperation).run(org.eclipse.core.runtime.IProgressMonitor) line: 742	
	org.eclipse.core.internal.resources.Workspace.run(org.eclipse.core.runtime.ICoreRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, int, org.eclipse.core.runtime.IProgressMonitor) line: 2448	
	org.eclipse.core.internal.resources.Workspace.run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, int, org.eclipse.core.runtime.IProgressMonitor) line: 2473	
	org.eclipse.jdt.core.JavaCore.run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor) line: 6082	
	org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(org.eclipse.core.runtime.IProgressMonitor) line: 108	
	org.eclipse.jface.operation.ModalContext$ModalContextThread.run() line: 124	

@jukzi
Copy link
Contributor Author

jukzi commented Feb 14, 2024

endless while loop in org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2.UnionFind.find(IType):101

@jukzi
Copy link
Contributor Author

jukzi commented Feb 14, 2024

RippleMethodFinder2.UnionFind.fElementToRepresentative
contains a vicious circle between

interface LeapableGenerator {key=Ljava/util/random/RandomGenerator$LeapableGenerator;} [in RandomGenerator$LeapableGenerator.class [in java.util.random [in <module:java.base>]]]
interface JumpableGenerator {key=Ljava/util/random/RandomGenerator$JumpableGenerator;} [in RandomGenerator$JumpableGenerator.class [in java.util.random [in <module:java.base>]]]

@jukzi
Copy link
Contributor Author

jukzi commented Feb 14, 2024

LeapableGenerator and JumpableGenerator both have a copy() method:

java.util.random.RandomGenerator.LeapableGenerator.copy()
java.util.random.RandomGenerator.JumpableGenerator.copy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant