diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-07-26 08:44:05 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-09-07 08:44:33 +0200 |
commit | 665d6a9498360104c662d138df79304210df66f2 (patch) | |
tree | 2f949bfaab09db010a6153cf32edb3593c63a9ad | |
parent | 0a1a66397b71d0e81270856db8eb30c55ec7adbd (diff) | |
download | aspectj-665d6a9498360104c662d138df79304210df66f2.tar.gz aspectj-665d6a9498360104c662d138df79304210df66f2.zip |
In ITD processing, use setter instead of assigning Scope directly
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>
3 files changed, 6 insertions, 3 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java index 5a2038f75..16182762c 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java @@ -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); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java index ff765515a..75e0a20e3 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java @@ -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; } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IntertypeMemberClassDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IntertypeMemberClassDeclaration.java index fe95dd53e..9fa9456aa 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IntertypeMemberClassDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/IntertypeMemberClassDeclaration.java @@ -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; } |