NPE when unresolved type of a bound var in a pointcut expression (EclipseFactory.java:224)tags/V1_5_0M2
@@ -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) { |
@@ -0,0 +1,5 @@ | |||
package a.b.c; | |||
public interface I { | |||
} |
@@ -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); | |||
} | |||
} |
@@ -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) { |
@@ -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"/> |