summaryrefslogtreecommitdiffstats
path: root/tests/bugs150/Pr113368.aj
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-11-23 12:52:27 +0000
committeracolyer <acolyer>2005-11-23 12:52:27 +0000
commit8b294d9e4f02625c4c3391612242969fb4b6be57 (patch)
tree15b4adfb80b1d162c1a48191b694acfda70eae19 /tests/bugs150/Pr113368.aj
parent504e4300204475cef1254de5d1308863c43b26e7 (diff)
downloadaspectj-8b294d9e4f02625c4c3391612242969fb4b6be57.tar.gz
aspectj-8b294d9e4f02625c4c3391612242969fb4b6be57.zip
tests and fix for pr103157
Diffstat (limited to 'tests/bugs150/Pr113368.aj')
-rw-r--r--tests/bugs150/Pr113368.aj56
1 files changed, 36 insertions, 20 deletions
diff --git a/tests/bugs150/Pr113368.aj b/tests/bugs150/Pr113368.aj
index b9d067df6..7f70c7a6d 100644
--- a/tests/bugs150/Pr113368.aj
+++ b/tests/bugs150/Pr113368.aj
@@ -1,36 +1,52 @@
+
public aspect Pr113368 {
-
- private pointcut managedBeanConstruction(ManagedBean bean) :
- execution(ManagedBean+.new(..)) && this(bean);
+
+ public static void main(String[] args) {
+ try {
+ aspectOf().hook();
+ } catch (ExceptionInInitializerError ex) {
+ Throwable cause = ex.getCause();
+ if (! (cause instanceof org.aspectj.lang.NoAspectBoundException)) {
+ throw new RuntimeException("Unexpected exception: " + cause);
+ }
+ }
+ }
+
+ void hook() {}
+ private pointcut managedBeanConstruction(ManagedBean bean) :
+ execution(ManagedBean+.new(..)) && this(bean);
+
//NPE's on the if pointcut below
private pointcut topLevelManagedBeanConstruction(ManagedBean bean) :
managedBeanConstruction(bean) &&
if(thisJoinPointStaticPart.getSignature().getDeclaringType() == bean.getClass());
after(ManagedBean bean) returning: topLevelManagedBeanConstruction(bean) {
- System.out.println("I just constructed " + bean);
+ System.out.println("I just constructed " + bean);
}
- public static void main(String[] args) {
- new ManagedBean("super-bean");
- new ManagedSubBean();
+}
+
+abstract aspect ManagedBean {
+}
+
+
+aspect ManagedSubBean extends ManagedBean {
+
+ before() : execution(* hook()) {
}
}
-class ManagedBean {
-
- public ManagedBean(String s) {
- System.out.println(s);
- }
+aspect AutoStart {
+ before() : staticinitialization(ManagedBean) {
+ ManagedSubBean.aspectOf();
+ }
}
-
-class ManagedSubBean extends ManagedBean {
-
- public ManagedSubBean() {
- super("sub-bean");
- }
-
-} \ No newline at end of file
+aspect Tracer {
+ before() : !within(Tracer) {
+ System.out.println(thisJoinPoint);
+}
+}