aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AroundNumericCastCE.java
blob: 4e357ebd3c845ec7b462aebcf123d6f57cd28cdf (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
import org.aspectj.testing.Tester;

/** @testcase PR#838 checking around join point for advice return type - numeric */
public class AroundNumericCastCE {
    
    public static double doubleMethod(int total){
        return (double) total;
    }
    
    public static int intMethod(int total){
        return total;
    }
    
    public static aspect Selector{
        // expect CE "illegal return value" from execution(int intMethod(int))
        double around(int i) : execution(* *Method(int)) && args(i) { // CE 17
            return proceed(i);
        }
    }
    public static void main(String[] args){
        double result = doubleMethod(1000);
        Tester.check(result != 0, "calculatePayment(1000)");
    }
}