Skip to content

Commit dfbb51b

Browse files
CompleteTypeBindingsSteps.INTEGRATE_ANNOTATIONS_IN_HIERARCHY violates
TypeBinding's protocol by direct updation of fields in various places * Fixes #4823
1 parent 7f2f38b commit dfbb51b

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ public void updateSupertypesWithAnnotations(Map<ReferenceBinding,ReferenceBindin
18811881
}
18821882
}
18831883
if (this.superclass != null) {
1884-
this.binding.superclass = updateWithAnnotations(this.superclass, this.binding.superclass, outerUpdates, updates);
1884+
this.binding.setSuperClass(updateWithAnnotations(this.superclass, this.binding.superclass, outerUpdates, updates)); // don't assign directly to superclass!
18851885
}
18861886
if (this.superInterfaces != null) {
18871887
ReferenceBinding[] superIfcBindings = this.binding.superInterfaces;

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ public void updateWithAnnotations(ClassScope scope) {
236236
this.type.updateWithAnnotations(scope, Binding.DefaultLocationTypeBound);
237237
if (this.type.resolvedType instanceof ReferenceBinding && prevType != this.type.resolvedType) { //$IDENTITY-COMPARISON$
238238
ReferenceBinding newType = (ReferenceBinding) this.type.resolvedType;
239-
this.binding.firstBound = newType;
239+
this.binding.setFirstBound(newType); // do not assign to firstBound directly!
240240
if (newType.isClass())
241-
this.binding.superclass = newType;
241+
this.binding.setSuperClass(newType); // do not assign to superclass directly!
242242
}
243243
}
244244
if (this.bounds != null) {

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ SourceTypeBinding buildType(SourceTypeBinding enclosingType, PackageBinding pack
486486
}
487487

488488
TypeParameter[] typeParameters = this.referenceContext.typeParameters;
489-
sourceType.typeVariables = typeParameters == null || typeParameters.length == 0 ? Binding.NO_TYPE_VARIABLES : null;
489+
sourceType.setTypeVariables(typeParameters == null || typeParameters.length == 0 ? Binding.NO_TYPE_VARIABLES : null); // don't assign directly!
490490
sourceType.fPackage.addType(sourceType);
491491
checkAndSetModifiers();
492492
buildTypeVariables();
@@ -1376,7 +1376,7 @@ void buildComponents() {
13761376
}
13771377
if (count != rcbs.length) // remove duplicate or broken components
13781378
System.arraycopy(rcbs, 0, rcbs = count == 0 ? Binding.NO_COMPONENTS : new RecordComponentBinding[count], 0, count);
1379-
sourceType.components = rcbs;
1379+
sourceType.setComponents(rcbs); // don't assign directly to components!
13801380
}
13811381
ReferenceBinding[] memberTypes = sourceType.memberTypes;
13821382
if (memberTypes != null) {

0 commit comments

Comments
 (0)