summaryrefslogtreecommitdiffstats
path: root/tests/compatibility/case2/TrackingErrors.aj
blob: 42659de6c4229ee227db7d4125602ba5256bfbb1 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import org.aspectj.lang.*;

import org.aspectj.lang.JoinPoint;

public abstract aspect TrackingErrors {

   protected abstract pointcut errorScope ();

   private pointcut staticContext () : !this(Object);
   private pointcut nonStaticContext (Object obj) : this(obj);
   private pointcut caughtThrowable (Throwable th) : handler(Throwable+)
           && args(th);



   private pointcut excluded () : within(TrackingErrors+);

   before (Throwable th) : caughtThrowable(th) && errorScope() &&
           !excluded() && staticContext() {

           processStaticTrackingErrors(th,thisJoinPointStaticPart,thisEnclosingJoinPointStaticPart);
   }

   before (Throwable th, Object obj) : caughtThrowable(th) && errorScope()
           && !excluded() && nonStaticContext(obj) {

           processNonStaticTrackingErrors(th,obj,thisJoinPointStaticPart,thisEnclosingJoinPointStaticPart);
   }

   protected  void processStaticTrackingErrors (Throwable th,
           JoinPoint.StaticPart tjp, JoinPoint.StaticPart ejp) {}

   protected void processNonStaticTrackingErrors (Throwable th, Object obj,
           JoinPoint.StaticPart tjp, JoinPoint.StaticPart ejp) {}

   protected String getSourceId (JoinPoint.StaticPart ejp) {
                 String typeName =
           ejp.getSignature().getDeclaringTypeName();
                 String name = ejp.getSignature().getName();
           return typeName + "." + name;
   }

   protected String getProbeId (JoinPoint.StaticPart tjp) {
                 String sourceLocation =
           tjp.getSourceLocation().toString();
           return sourceLocation;
   }

}
/*public abstract aspect Complex {
    
    protected abstract pointcut scope ();
    
    private pointcut staticContext () : !this(Object);
    private pointcut nonStaticContext (Object obj) : this(obj);
    private pointcut caughtThrowable (Throwable th) : handler(Throwable+) && args(th);
 
    private pointcut excluded () : within(Complex+);
 
    before (Throwable th) : caughtThrowable(th) && scope() && !excluded() && staticContext() {
       processStaticData(th,thisJoinPointStaticPart,thisEnclosingJoinPointStaticPart);
    }
 
    before (Throwable th, Object obj) : caughtThrowable(th) && scope() && !excluded() && nonStaticContext(obj) {
       processNonStaticData(th,obj,thisJoinPointStaticPart,thisEnclosingJoinPointStaticPart);
    }
    
    private void processStaticData (Throwable th, JoinPoint.StaticPart tjp, JoinPoint.StaticPart ejp) {
    }
 
    private void processNonStaticData (Throwable th, Object obj, JoinPoint.StaticPart tjp, JoinPoint.StaticPart ejp) {
    }
 
    protected String getSourceId (JoinPoint.StaticPart ejp) {
        String typeName = ejp.getSignature().getDeclaringTypeName();
        String name = ejp.getSignature().getName();
        return typeName + "." + name;
    }
 
    protected String getProbeId (JoinPoint.StaticPart tjp) {
        String sourceLocation = String.valueOf(tjp.getSourceLocation().getLine());
        return sourceLocation;
    }
 
}
*/