aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs170/pr382723/Foo.java
blob: cbb32b9142777a1a2c67fc7a72a440ca35b4137b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.AbstractList;
import java.util.LinkedList;
import java.util.List;

abstract aspect FooAspectParent<T extends List> {
    protected int getNumber(int k) {
        return -1*k;
    }
}

abstract privileged aspect FooAspect<T extends AbstractList> extends FooAspectParent<T> {
    pointcut pc():  call(T.new()) && !within(Bar); 

    T around():pc() {
        System.out.println("superaspect getNumber returns "+getNumber(2)); 
        System.out.println("abstract method returns "+method());
		localMethod();
        Math.random(); //<-- works
        hashCode(); //<-- works
        return null;
    }    

    private void localMethod(){}

    protected abstract T method();
}

aspect Bar extends FooAspect<LinkedList> {
  protected LinkedList method() {
    System.out.println("Bar.method() running");
	return new LinkedList();
  }
}

public class Foo {

    public static void main(String[] argv) {
	  new Foo().bar();
    }
    public LinkedList bar() {
        new LinkedList();
        return null;
    }
}