aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs153/pr161502/Main2.java
blob: b87503b28f64ef6595123caf55eb0f110b855c2f (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
import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

public class Main2 {

  public List<? extends Element> getElements() {
    return new ArrayList<Element>();
  }

  class Element {};

  @Aspect
  static abstract class Base<T> {
    @Around("call(List<? extends T> *.*(..))")
    public List<? extends T> elementList(ProceedingJoinPoint thisJoinPoint) {
      try {
        return (List<? extends T>)thisJoinPoint.proceed();
      } catch (Throwable e) {
        throw new RuntimeException(e);
      }
    }
  }

  @Aspect
  static class Concrete extends Base<String> {} // pointcut won't match because not a call to "List<? extends String> *(..)"

  public static void main(String[] args) {
    new Main2().getElements();
  }

}