Skip to content

Commit

Permalink
fix: make detailed var info deterministic (PR #2231)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubiqq authored Jul 31, 2024
1 parent bda3119 commit 61855a7
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -292,10 +293,19 @@ public String getDetailedVarInfo(MethodNode mth) {
StringBuilder sb = new StringBuilder();
sb.append('r').append(regNum).append('v').append(version);
if (!names.isEmpty()) {
sb.append(", names: ").append(names);
String orderedNames = names.stream()
.sorted()
.collect(Collectors.joining(", ", "[", "]"));

sb.append(", names: ").append(orderedNames);
}
if (!types.isEmpty()) {
sb.append(", types: ").append(types);
String orderedTypes = types.stream()
.map(String::valueOf)
.sorted()
.collect(Collectors.joining(", ", "[", "]"));

sb.append(", types: ").append(orderedTypes);
}
return sb.toString();
}
Expand Down

0 comments on commit 61855a7

Please # to comment.