diff options
author | Andy Clement <aclement@pivotal.io> | 2020-04-22 10:42:51 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2020-04-22 10:42:51 -0700 |
commit | 8fa573040ff3e4caa6d0e2a1cf63bb0c62dd3ad9 (patch) | |
tree | 6589d45325b241ff81daa86035b0b19bc09a3720 | |
parent | fdd79adcffd53c15ec9664237935bc47179e923f (diff) | |
download | aspectj-8fa573040ff3e4caa6d0e2a1cf63bb0c62dd3ad9.tar.gz aspectj-8fa573040ff3e4caa6d0e2a1cf63bb0c62dd3ad9.zip |
Fix for 558995: NullPointerException at org.aspectj.weaver.ReferenceType.getWeaverState
-rw-r--r-- | org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index 062f04fd2..47357df67 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -1100,10 +1100,16 @@ public class EclipseFactory { typexToBinding.put(fromBinding(binding), binding); } - public void addTypeBindingAndStoreInWorld(TypeBinding binding) { + public void addTypeBindingAndStoreInWorld(SourceTypeBinding binding) { UnresolvedType ut = fromBinding(binding); typexToBinding.put(ut, binding); - world.lookupOrCreateName(ut); + ReferenceType rt = world.lookupOrCreateName(ut); + // Ensure a delegate is set (#558995) + // TODO the delegate is perhaps not 100% ideal as the decl is the aspect? + TypeDeclaration decl = binding.scope.referenceContext; + CompilationUnitDeclaration referenceCompilationUnit = binding.scope.referenceCompilationUnit(); + EclipseSourceType t = new EclipseSourceType(rt, this, binding, decl, referenceCompilationUnit); + rt.setDelegate(t); } public Shadow makeShadow(ASTNode location, ReferenceContext context) { |