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 dd7b0d6f3e7..125c27e6c3a 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 @@ -1198,13 +1198,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); } @@ -1335,7 +1334,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())