From 39c1ec521f38ec6dc62fc529a185cfec4522211a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Wed, 14 Feb 2024 13:36:13 +0100 Subject: [PATCH] fix endless loop in RippleMethodFinder2.UnionFind.find(IType) #1192 https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1192 --- .../corext/refactoring/rename/RippleMethodFinder2.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java index 745382f2c06..54f970989c7 100644 --- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java +++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java @@ -98,7 +98,8 @@ public void init(IType type) { public IType find(IType element) { IType root= element; IType rep= fElementToRepresentative.get(root); - while (rep != null && ! rep.equals(root)) { + Set visited=new HashSet<>(); + while (rep != null && visited.add(root)) { root= rep; rep= fElementToRepresentative.get(root); }