You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/10/11 18:43:18 UTC

(commons-bcel) branch master updated: Bugfix in example.TransitiveHull, there was an infinite loop before, testest with: class A extends B{C c = new C()}; class B{}; class C{} and TransitiveHull.main(String[]{"A"}) (#476)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 85456edf Bugfix in example.TransitiveHull, there was an infinite loop before, testest with: class A extends B{C c = new C()}; class B{}; class C{} and TransitiveHull.main(String[]{"A"}) (#476)
85456edf is described below

commit 85456edf41dea75c12eb8ce94c5e06c5389c42e3
Author: fmantz <fm...@users.noreply.github.com>
AuthorDate: Sat Oct 11 20:43:11 2025 +0200

    Bugfix in example.TransitiveHull, there was an infinite loop before, testest with: class A extends B{C c = new C()}; class B{}; class C{} and TransitiveHull.main(String[]{"A"}) (#476)
    
    Verified locally and manually.
---
 src/examples/TransitiveHull.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/examples/TransitiveHull.java b/src/examples/TransitiveHull.java
index 307f1a30..32bf864d 100644
--- a/src/examples/TransitiveHull.java
+++ b/src/examples/TransitiveHull.java
@@ -102,6 +102,12 @@ public class TransitiveHull extends org.apache.bcel.classfile.EmptyVisitor {
     private void add(String className) {
         className = Utility.pathToPackage(className);
 
+        for (final String alreadyContained : set.getClassNames()) {
+            if (alreadyContained.equals(className)) {
+                return;
+            }
+        }
+
         for (final String anIgnored : ignored) {
             if (Pattern.matches(anIgnored, className)) {
                 return;