Skip to content

Commit

Permalink
NPE check in DOMCompletionEngine when erasure is null
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
Rob Stryker committed Dec 11, 2024
1 parent 3dda5a5 commit 3cf434e
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1234,25 +1234,28 @@ private void processMembers(ITypeBinding typeBinding, Bindings scope,
}

private static boolean findInSupers(ITypeBinding root, ITypeBinding toFind) {
String keyToFind = toFind.getErasure().getKey();
Queue<ITypeBinding> toCheck = new LinkedList<>();
Set<String> alreadyChecked = new HashSet<>();
toCheck.add(root.getErasure());
while (!toCheck.isEmpty()) {
ITypeBinding current = toCheck.poll();
String currentKey = current.getErasure().getKey();
if (alreadyChecked.contains(currentKey)) {
continue;
}
alreadyChecked.add(currentKey);
if (currentKey.equals(keyToFind)) {
return true;
}
for (ITypeBinding superInterface : current.getInterfaces()) {
toCheck.add(superInterface);
}
if (current.getSuperclass() != null) {
toCheck.add(current.getSuperclass());
ITypeBinding superFind = toFind.getErasure();
if( superFind != null ) {
String keyToFind = superFind.getKey();
Queue<ITypeBinding> toCheck = new LinkedList<>();
Set<String> alreadyChecked = new HashSet<>();
toCheck.add(root.getErasure());
while (!toCheck.isEmpty()) {
ITypeBinding current = toCheck.poll();
String currentKey = current.getErasure().getKey();
if (alreadyChecked.contains(currentKey)) {
continue;
}
alreadyChecked.add(currentKey);
if (currentKey.equals(keyToFind)) {
return true;
}
for (ITypeBinding superInterface : current.getInterfaces()) {
toCheck.add(superInterface);
}
if (current.getSuperclass() != null) {
toCheck.add(current.getSuperclass());
}
}
}
return false;
Expand Down

0 comments on commit 3cf434e

Please sign in to comment.