Skip to content

Commit

Permalink
Fixed ChangeType for stackoverflow (#3929)
Browse files Browse the repository at this point in the history
* Fixed ChangeType for stackoverflow

* Apply suggestions from code review

---------

Co-authored-by: Tim te Beek <[email protected]>
Co-authored-by: Tim te Beek <[email protected]>
Co-authored-by: Jonathan Schnéider <[email protected]>
  • Loading branch information
4 people authored Jul 24, 2024
1 parent 116bac6 commit f073c00
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, At
}

public static JavaType.FullyQualified getTopLevelClassName(JavaType.FullyQualified classType) {
if (classType.getOwningClass() == null) {
if (classType.getOwningClass() == null || TypeUtils.fullyQualifiedNamesAreEqual(classType.getFullyQualifiedName(),
classType.getOwningClass().getFullyQualifiedName())) {
return classType;
}
return getTopLevelClassName(classType.getOwningClass());
Expand Down

0 comments on commit f073c00

Please sign in to comment.