]> source.dussan.org Git - aspectj.git/commitdiff
In ITD processing, use setter instead of assigning Scope directly
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Mon, 26 Jul 2021 01:44:05 +0000 (08:44 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Tue, 7 Sep 2021 06:44:33 +0000 (08:44 +0200)
Change calls like
  pre.scope.parent = newParent;
to this pattern:
  // Use setter in order to also update member 'compilationUnitScope'
  pre.scope.setParent(newParent);

This should fix lots of failing tests after updating JDT Core.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IntertypeMemberClassDeclaration.java

index 5a2038f754eaee3ed2392ff3b95c358f94867356..16182762c3683d3af85854b6644f1022797d741e 100644 (file)
@@ -192,7 +192,8 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
                }
 
                InterTypeScope newParent = new InterTypeScope(scope, onTypeBinding);
-               pre.scope.parent = newParent;
+               // Use setter in order to also update member 'compilationUnitScope'
+               pre.scope.setParent(newParent);
 
                pre.resolveStatements(); // newParent);
 
index ff765515ac6225010651749052354e1035a5afd0..75e0a20e399737db252a60a19d1ae2833580ac85 100644 (file)
@@ -146,7 +146,8 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
 
                if (!scopeSetup) {
                  interTypeScope = new InterTypeScope(upperScope, onTypeBinding,typeVariableAliases);
-                 scope.parent = interTypeScope;
+                       // Use setter in order to also update member 'compilationUnitScope'
+                       scope.setParent(interTypeScope);
                  this.scope.isStatic = Modifier.isStatic(declaredModifiers);
                  scopeSetup = true;
                }
index fe95dd53e3e5f8548aeed8b2413b25adb7c37657..9fa9456aa89ba993aeb5e69785a962337c23b4b0 100644 (file)
@@ -203,7 +203,8 @@ public class IntertypeMemberClassDeclaration extends TypeDeclaration {
                        // this is the original version in case tricking the JDT causes grief (if you reinstate this variant, you
                        // will need to change the expected messages output for some of the generic ITD tests)
                        // scope.isStatic = Modifier.isStatic(declaredModifiers);
-                       scope.parent = interTypeScope;
+                       // Use setter in order to also update member 'compilationUnitScope'
+                       scope.setParent(interTypeScope);
                }
                scopeSetup = true;
        }