From 2683dcf34e16fdb13556181c8556b397049117a6 Mon Sep 17 00:00:00 2001 From: Zsombor Gegesy Date: Wed, 31 May 2023 10:17:53 +0200 Subject: [PATCH] Remove unnecessary 'collectAllTypeBindings(...)' call --- .../jdt/internal/compiler/lookup/SourceTypeBinding.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index 289d03c8cf1..6a867866b12 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -1194,13 +1194,12 @@ else if (this.isInterface()) else if (this.isInterface()) this.scope.problemReporter().sealedMissingInterfaceModifier(this, typeDecl, sealedEntry.getValue()); } - List typesInCU = collectAllTypeBindings(typeDecl, this.scope.compilationUnitScope()); - if (!typeDecl.isRecord() && typeDecl.superclass != null && !checkPermitsAndAdd(this.superclass, typesInCU)) { + if (!typeDecl.isRecord() && typeDecl.superclass != null && !checkPermitsAndAdd(this.superclass)) { reportSealedSuperTypeDoesNotPermitProblem(typeDecl.superclass, this.superclass); } for (int i = 0, l = this.superInterfaces.length; i < l; ++i) { ReferenceBinding superInterface = this.superInterfaces[i]; - if (superInterface != null && !checkPermitsAndAdd(superInterface, typesInCU)) { + if (superInterface != null && !checkPermitsAndAdd(superInterface)) { TypeReference superInterfaceRef = typeDecl.superInterfaces[i]; reportSealedSuperTypeDoesNotPermitProblem(superInterfaceRef, superInterface); } @@ -1331,7 +1330,7 @@ private void checkAndAddBinding(SourceTypeBinding stb) { return typeCollector.types; } -private boolean checkPermitsAndAdd(ReferenceBinding superType, List types) { +private boolean checkPermitsAndAdd(ReferenceBinding superType) { if (superType == null || superType.equals(this.scope.getJavaLangObject()) || !superType.isSealed())