diff options
author | acolyer <acolyer> | 2005-03-10 13:34:55 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-03-10 13:34:55 +0000 |
commit | 85aa1520881e7271e658b9377dfd020fde28868c (patch) | |
tree | be10a11fe7dd8c4799c4ca75d870bba801d86d94 | |
parent | ea5908c3891ef93331c89e5738770af2712cb5dd (diff) | |
download | aspectj-85aa1520881e7271e658b9377dfd020fde28868c.tar.gz aspectj-85aa1520881e7271e658b9377dfd020fde28868c.zip |
fix for Bugzilla Bug 87376
NPE when unresolved type of a bound var in a pointcut expression (EclipseFactory.java:224)
5 files changed, 36 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index f77f10f0a..da6f43a17 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -381,8 +381,12 @@ public class AsmHierarchyBuilder extends ASTVisitor { World world = ((AjLookupEnvironment)declaration.scope.environment()).factory.getWorld(); TypeX onType = rp.onType; if (onType == null) { - Member member = EclipseFactory.makeResolvedMember(declaration.binding); - onType = member.getDeclaringType(); + if (declaration.binding != null) { + Member member = EclipseFactory.makeResolvedMember(declaration.binding); + onType = member.getDeclaringType(); + } else { + return null; + } } ResolvedMember[] members = onType.getDeclaredPointcuts(world); if (members != null) { diff --git a/tests/bugs150/pr87376/I.java b/tests/bugs150/pr87376/I.java new file mode 100644 index 000000000..78dd3459b --- /dev/null +++ b/tests/bugs150/pr87376/I.java @@ -0,0 +1,5 @@ +package a.b.c; + +public interface I { + +}
\ No newline at end of file diff --git a/tests/bugs150/pr87376/NPE.aj b/tests/bugs150/pr87376/NPE.aj new file mode 100644 index 000000000..77d7510ff --- /dev/null +++ b/tests/bugs150/pr87376/NPE.aj @@ -0,0 +1,14 @@ +package a.b.d; +//import a.b.c.I; + + + +public aspect NPE { + + pointcut ii(I i) : execution(* I.*(..)) && this(i); + + after(I i) returning : ii(i) { + System.out.println(i); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 556f2d4ea..82e1aed27 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -125,6 +125,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { } } + public void npeOnTypeNotFound() { + runTest("structure model npe on type not found"); + } + // helper methods..... public SyntheticRepository createRepos(File cpentry) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 7329d2996..e043fc878 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -40,6 +40,13 @@ </compile> </ajc-test> + <ajc-test dir="bugs150/pr87376" title="structure model npe on type not found"> + <compile files="I.java,NPE.aj" options="-emacssym"> + <message kind="error" line="8" text="I cannot be resolved to a type"/> + <message kind="error" line="10" text="I cannot be resolved to a type"/> + </compile> + </ajc-test> + <ajc-test dir="decp" pr="80249" title="Order of types passed to compiler determines weaving behavior"> <compile files="A.java,B.java,AspectX.java"/> <run class="B"/> |