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 <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed Dec 11, 2024
1 parent 0615a26 commit dea4142
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1208,25 +1208,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 dea4142

Please sign in to comment.