Skip to content

Commit

Permalink
GP-4586 corrected and simplified method to generate class description to
Browse files Browse the repository at this point in the history
fix order of parents.
  • Loading branch information
ghidra007 committed May 8, 2024
1 parent 90925d1 commit 78425f4
Showing 1 changed file with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3172,26 +3172,18 @@ public StringBuffer createParentStringBuffer(RecoveredClass recoveredClass)

if (recoveredClass.hasParentClass()) {

// use this to get direct parents
Map<RecoveredClass, List<RecoveredClass>> classHierarchyMap =
recoveredClass.getClassHierarchyMap();
Set<RecoveredClass> directParents = classHierarchyMap.keySet();

// use this to get correct parent order and to get the type of parent
Map<RecoveredClass, Boolean> parentToBaseTypeMap =
recoveredClass.getParentToBaseTypeMap();
Set<RecoveredClass> ancestors = parentToBaseTypeMap.keySet();
for (RecoveredClass ancestor : ancestors) {
monitor.checkCancelled();
if (directParents.contains(ancestor)) {

Boolean isVirtualParent = parentToBaseTypeMap.get(ancestor);
if (isVirtualParent != null && isVirtualParent) {
classString = classString.concat(" : virtual " + ancestor.getName());
}
else {
classString = classString.concat(" : " + ancestor.getName());
}
List<RecoveredClass> parentList = recoveredClass.getParentList();
for (RecoveredClass parent : parentList) {
monitor.checkCancelled();
Boolean isVirtualParent = parentToBaseTypeMap.get(parent);
if (isVirtualParent != null && isVirtualParent) {
classString = classString.concat(" : virtual " + parent.getName());
}
else {
classString = classString.concat(" : " + parent.getName());
}
}
}
Expand Down

0 comments on commit 78425f4

Please sign in to comment.