aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features153/ptw/CaseOne.java
blob: ea310ae704c48a09476e0bcae183413cd493daa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Types not in packages

class AClass {}
class BClass {}
class CClass {}

public aspect CaseOne pertypewithin(*Class) {
  public static void main(String []argv) {
    new Runner().run();
  }
}

class Runner {
  public void run() {
    if (CaseOne.hasAspect(AClass.class)) {
      System.out.println("AClass has an aspect instance");
      CaseOne instance = CaseOne.aspectOf(AClass.class);
      String name = instance.getWithinTypeName();
      System.out.println("The aspect instance thinks it is for type name "+name);
    }
  }
}