浏览代码

two test programs for 115250

tags/V1_5_0RC1
aclement 18 年前
父节点
当前提交
6bda5d41e9
共有 2 个文件被更改,包括 74 次插入0 次删除
  1. 36
    0
      tests/bugs150/pr115250.aj
  2. 38
    0
      tests/bugs150/pr115250_2.aj

+ 36
- 0
tests/bugs150/pr115250.aj 查看文件

@@ -0,0 +1,36 @@
public class pr115250 {
public static void main(String[] args) {
test();
}
public static void test() {
new C();
}

static class C {
C() {
System.err.println("C.new() running");
}
}

// properly get compiler error wrt return type of join point
static aspect Normal {
C around() : execution(C.new()) {
return proceed();
}
}
// no compiler error wrt return type of join point
static abstract aspect SS<Target> {
abstract protected pointcut creation();
Target around() : creation() { // expect CE for execution(C.new());
System.err.println("Advice running");
return proceed();
}
}
static aspect A extends SS<C> {
protected pointcut creation() : execution(C.new());
}
}

+ 38
- 0
tests/bugs150/pr115250_2.aj 查看文件

@@ -0,0 +1,38 @@
public class pr115250_2 {
public static void main(String[] args) {
test();
}
public static void test() {
new C().foo();
}

static class C {
C() {
System.err.println("C.new() running");
}

C foo() { return null; }
}

// properly get compiler error wrt return type of join point
static aspect Normal {
C around() : execution(* C.foo()) {
return proceed();
}
}
// no compiler error wrt return type of join point
static abstract aspect SS<Target> {
abstract protected pointcut creation();
Target around() : creation() { // expect CE for execution(C.new());
System.err.println("funky advice running");
return proceed();
}
}
static aspect A extends SS<C> {
protected pointcut creation() : execution(* C.foo());
}
}

正在加载...
取消
保存