Skip to content

Commit

Permalink
Remove unnecessary 'collectAllTypeBindings(...)' call
Browse files Browse the repository at this point in the history
  • Loading branch information
gzsombor authored and iloveeclipse committed May 3, 2024
1 parent 68e8c0c commit 80db252
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1198,13 +1198,12 @@ else if (this.isInterface())
else if (this.isInterface())
this.scope.problemReporter().sealedMissingInterfaceModifier(this, typeDecl, sealedEntry.getValue());
}
List<SourceTypeBinding> 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);
}
Expand Down Expand Up @@ -1335,7 +1334,7 @@ private void checkAndAddBinding(SourceTypeBinding stb) {
return typeCollector.types;
}

private boolean checkPermitsAndAdd(ReferenceBinding superType, List<SourceTypeBinding> types) {
private boolean checkPermitsAndAdd(ReferenceBinding superType) {
if (superType == null
|| superType.equals(this.scope.getJavaLangObject())
|| !superType.isSealed())
Expand Down

0 comments on commit 80db252

Please sign in to comment.