]> source.dussan.org Git - aspectj.git/commitdiff
Fix for 558995: NullPointerException at org.aspectj.weaver.ReferenceType.getWeaverState
authorAndy Clement <aclement@pivotal.io>
Wed, 22 Apr 2020 17:42:51 +0000 (10:42 -0700)
committerAndy Clement <aclement@pivotal.io>
Wed, 22 Apr 2020 17:42:51 +0000 (10:42 -0700)
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java

index 062f04fd2a0027ae79b12dc45bb67cc4046d8474..47357df674f6c836d54c6790036c5ff51e9fc1d3 100644 (file)
@@ -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) {