From 296f1886964cedcfdef113330045625a680fabd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= <51790620+jukzi@users.noreply.github.com> Date: Wed, 14 Feb 2024 21:27:46 +0100 Subject: [PATCH] fix endless loop in RippleMethodFinder2.UnionFind.find(IType) #1192 (#1193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1192 Co-authored-by: Jörg Kubitz --- .../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); }