From dea4142c73654e772fd7f4affe8742d1a51d8673 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Wed, 11 Dec 2024 13:42:33 -0500 Subject: [PATCH] NPE check in DOMCompletionEngine when erasure is null Signed-off-by: Rob Stryker --- .../codeassist/DOMCompletionEngine.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java index 42b47aa3e2e..7002a58ddd0 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java @@ -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 toCheck = new LinkedList<>(); - Set 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 toCheck = new LinkedList<>(); + Set 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;