Skip to content

Commit

Permalink
Implemented fix for the issue
Browse files Browse the repository at this point in the history
Added safe checks for the optional parameters
  • Loading branch information
4everTheOne committed Jan 8, 2021
1 parent 7fe532f commit 0ca8963
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,18 @@ public List<ResolvedReferenceType> getAncestors(boolean acceptIncompleteList) {
try {
// If an implemented interface is found, add it as an ancestor
ResolvedReferenceType rrt = toReferenceType(implemented);
ResolvedTypeDeclaration rtd = rrt.getTypeDeclaration().get().asType();
// do not consider an inner or nested class as an ancestor
if (!rtd.getQualifiedName().contains(wrappedNode.getFullyQualifiedName().get())) {
ancestors.add(rrt);
Optional<ResolvedReferenceTypeDeclaration> resolvedReferenceTypeDeclaration = rrt.getTypeDeclaration();
if (resolvedReferenceTypeDeclaration.isPresent()) {

ResolvedTypeDeclaration rtd = resolvedReferenceTypeDeclaration.get().asType();
Optional<String> qualifiedName = wrappedNode.getFullyQualifiedName();
if (qualifiedName.isPresent()) {

// do not consider an inner or nested class as an ancestor
if (!rtd.getQualifiedName().contains(qualifiedName.get())) {
ancestors.add(rrt);
}
}
}
} catch (UnsolvedSymbolException e) {
// in case we could not resolve some implemented interface, we may still be able to resolve the
Expand Down

0 comments on commit 0ca8963

Please sign in to comment.