Skip to content

Commit a6f1b58

Browse files
Discriminate record component accessors by using a dedicated purpose code RecordComponentReadAccess (eclipse-jdt#4136)
1 parent 9c42c83 commit a6f1b58

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ public void addSpecialMethods(TypeDeclaration typeDecl) {
983983
for (int i = emittedSyntheticsCount, max = currentSyntheticsCount; i < max; i++) {
984984
SyntheticMethodBinding syntheticMethod = syntheticMethods[i];
985985
switch (syntheticMethod.purpose) {
986+
case SyntheticMethodBinding.RecordComponentReadAccess :
986987
case SyntheticMethodBinding.FieldReadAccess :
987988
case SyntheticMethodBinding.SuperFieldReadAccess :
988989
// generate a method info to emulate an reading access to

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void checkNullSpecInheritance(MethodBinding currentMethod, AbstractMethodDeclara
284284
} else if (currentMethod instanceof SyntheticMethodBinding) {
285285
SyntheticMethodBinding synth = (SyntheticMethodBinding) currentMethod;
286286
switch (synth.purpose) {
287-
case SyntheticMethodBinding.FieldReadAccess:
287+
case SyntheticMethodBinding.RecordComponentReadAccess:
288288
if (synth.recordComponentBinding != null) {
289289
RecordComponent sourceRecordComponent = synth.sourceRecordComponent();
290290
if (sourceRecordComponent != null)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public class SyntheticMethodBinding extends MethodBinding {
8181
public static final int RecordOverrideHashCode = 20;
8282
public static final int RecordOverrideEquals = 21;
8383
public static final int RecordCanonicalConstructor = 22;
84+
public final static int RecordComponentReadAccess = 23;
8485

8586
public int sourceStart = 0; // start position of the matching declaration
8687
public int index; // used for sorting access methods in the class file
@@ -530,7 +531,7 @@ public SyntheticMethodBinding(SourceTypeBinding declaringClass, RecordComponentB
530531
this.selector = rcb.name;
531532
this.recordComponentBinding = rcb;
532533
this.targetReadField = rcb;
533-
this.purpose = SyntheticMethodBinding.FieldReadAccess;
534+
this.purpose = SyntheticMethodBinding.RecordComponentReadAccess;
534535
this.thrownExceptions = Binding.NO_EXCEPTIONS;
535536
this.index = nextSmbIndex();
536537
this.sourceStart = rcb.sourceRecordComponent().sourceStart;

0 commit comments

Comments
 (0)