Skip to content

Commit

Permalink
Merge pull request #290 from Ladicek/fix-class-topological-order
Browse files Browse the repository at this point in the history
Fix class ordering when propagating type annotations
  • Loading branch information
Ladicek committed Dec 2, 2022
2 parents 2edfb82 + 751d90e commit 886c2a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/main/java/org/jboss/jandex/Indexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2448,14 +2448,18 @@ private boolean isEnclosedIn(ClassInfo c1, ClassInfo c2) {

@Override
public int compare(ClassInfo c1, ClassInfo c2) {
if (isEnclosedIn(c1, c2)) {
if (c1.name().equals(c2.name())) {
return 0;
} else if (isEnclosedIn(c1, c2)) {
// c1 is enclosed in c2, so c2 must be processed sooner
return 1;
} else if (isEnclosedIn(c2, c1)) {
// c2 is enclosed in c1, so c1 must be processed sooner
return -1;
} else {
return 0;
// we really only need partial order here,
// but `Comparator` must establish total order
return c1.name().compareTo(c2.name());
}
}
});
Expand Down

0 comments on commit 886c2a1

Please sign in to comment.