From 26a1f52e21858a9e133d150d46c408326fb559fe Mon Sep 17 00:00:00 2001 From: fedejeanne Date: Fri, 6 Dec 2024 10:38:55 +0100 Subject: [PATCH] Guard lookup in BoundSet::allSuperPairsWithCommonGenericTypeRecursive Contributes to https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3327 --- .../org/eclipse/jdt/internal/compiler/lookup/BoundSet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java index 360a4ea4408..a9f4c871098 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java @@ -1279,8 +1279,9 @@ private List> allSuperPairsWithCommonGenericTypeRecursive(Type } if (TypeBinding.equalsEquals(s, t)) return result; // optimization #2: nothing interesting above equal types - TypeBinding tSuper = t.findSuperTypeOriginatingFrom(s); - if (tSuper != null && s.isParameterizedType() && tSuper.isParameterizedType()) { // optimization #1 again + + TypeBinding tSuper = s.isParameterizedType() ? t.findSuperTypeOriginatingFrom(s) : null; + if (tSuper != null && tSuper.isParameterizedType()) { // optimization #1 again result.add(new Pair<>(s, tSuper)); } result.addAll(allSuperPairsWithCommonGenericTypeRecursive(s.superclass(), t, visited));