Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args);
World world = v.getType().getWorld();
ResolvedType desiredType = instanceofTest.getType().resolve(world);
- ResolvedType actualType = world.resolve(value.getClass().getName());
- matches = desiredType.isAssignableFrom(actualType);
+ if (value == null) {
+ matches = false;
+ } else {
+ ResolvedType actualType = world.resolve(value.getClass().getName());
+ matches = desiredType.isAssignableFrom(actualType);
+ }
}
public void visit(MatchingContextBasedTest matchingContextTest) {
/** this condition can occur on the build machine only, and is way too complex to fix right now... */
private boolean needToSkipPointcutParserTests() {
- if (!LangUtil.is15VMOrGreater())
+ if (!LangUtil.is15VMOrGreater()) {
return false;
+ }
try {
Class.forName("org.aspectj.weaver.reflect.Java15ReflectionBasedReferenceTypeDelegate", false, this.getClass()
.getClassLoader());// ReflectionBasedReferenceTypeDelegate.class.getClassLoader());
}
public void testMatchJP() throws Exception {
- if (needToSkip)
+ if (needToSkip) {
return;
+ }
PointcutParser parser = PointcutParser
.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
}
public void testBinding() throws Exception {
- if (needToSkip)
+ if (needToSkip) {
return;
+ }
PointcutParser parser = PointcutParser
.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
PointcutParameter ex = parser.createPointcutParameter("ex", Exception.class);
ShadowMatch sMatch = thisEx.matchesMethodCall(toString, toString);
Exception exceptionParameter = new Exception();
IOException ioExceptionParameter = new IOException();
- JoinPointMatch jpMatch = sMatch.matchesJoinPoint(exceptionParameter, null, null);
+ JoinPointMatch jpMatch = null;
+ jpMatch = sMatch.matchesJoinPoint(null, null, null);// 318899
+ assertFalse(jpMatch.matches());
+ jpMatch = sMatch.matchesJoinPoint(exceptionParameter, null, null);
assertTrue("should match", jpMatch.matches());
PointcutParameter[] bindings = jpMatch.getParameterBindings();
assertEquals("one binding", 1, bindings.length);
// DataOutputStream out = new DataOutputStream(bo);
// p.write(out);
// out.close();
- //
+ //
// ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
// DataInputStream in = new DataInputStream(bi);
// Pointcut newP = Pointcut.read(in, null);
- //
+ //
// assertEquals("write/read", p, newP);
// }
}