import org.aspectj.lang.reflect.MethodSignature; class A { } class Base { public A foo() { return null; } } public aspect Demo { public A Base.bar() { return null; } public Base Base.baz() { return null; } before(): execution(* Base.*(..)) { Class cs = ((MethodSignature)thisJoinPointStaticPart.getSignature()).getReturnType(); System.out.format("%s (%b)%n", cs, ClassNotFoundException.class == cs); } public static void main(String[] arg) { new Base().foo(); new Base().bar(); new Base().baz(); } }