File: invoke.java

package info (click to toggle)
jswat2 2.37-1
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 7,092 kB
  • ctags: 5,592
  • sloc: java: 43,576; xml: 1,086; sh: 66; makefile: 57
file content (133 lines) | stat: -rw-r--r-- 3,415 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// JSwat test case for the invoke command
// $Id: invoke.java 1093 2003-12-05 03:27:21Z nfiedler $

public class invoke {

    public static void main(String[] args) {
        System.out.println("stop here");
    }

    public static boolean method(boolean b) {
        return !b;
    }

    public static boolean method(Boolean b) {
        return b.booleanValue();
    }

    public static byte method(byte b) {
        byte b2 = 1;
        b += b2;
        return b;
    }

    public static byte method(Byte b) {
        return b.byteValue();
    }

    public static char method(char c) {
        return Character.toUpperCase(c);
    }

    public static char method(Character c) {
        return c.charValue();
    }

    public static double method(double d) {
        return Math.sqrt(d);
    }

    public static double method(Double d) {
        return d.doubleValue();
    }

    public static float method(float f) {
        float f2 = 0.333f;
        f *= f2;
        return f;
    }

    public static float method(Float f) {
        return f.floatValue();
    }

    public static int method(int i) {
        return i * 2;
    }

    public static int method(Integer i) {
        return i.intValue();
    }

    public static long method(long l) {
        return l * 10;
    }

    public static long method(Long l) {
        return l.longValue();
    }

    public static short method(short s) {
        short s2 = 2;
        s /= s2;
        return s;
    }

    public static short method(Short s) {
        return s.shortValue();
    }

    public static Number method(Number n) {
        return new Integer(n.intValue() * 3);
    }

    public static String method(String s) {
        return '"' + s + '"';
    }

    public static String method(Integer I, char c, int i, boolean b) {
        StringBuffer buf = new StringBuffer(80);
        buf.append(I);
        buf.append(", ");
        buf.append(c);
        buf.append(", ");
        buf.append(i);
        buf.append(", ");
        buf.append(b);
        return buf.toString();
    }

    public static String method(String s, char c, int i, boolean b) {
        StringBuffer buf = new StringBuffer(80);
        buf.append(s);
        buf.append(", ");
        buf.append(c);
        buf.append(", ");
        buf.append(i);
        buf.append(", ");
        buf.append(b);
        return buf.toString();
    }

    // Put these here so changes will not shift the code lines above.
    // Use these to test invoking the methods above. DO NOT CHANGE VALUES,
    // as the unit tests use these.
    private static boolean z_val = true;
    private static byte b_val = 8;
    private static char c_val = 'a';
    private static double d_val = 1.23456789;
    private static float f_val = 1.234f;
    private static int i_val = 1048576;
    private static int ic_val = 65; // value of 'a'
    private static long l_val = 72057594037927936L;
    private static short s_val = 256;

    private static Boolean z_Value = Boolean.TRUE;
    private static Byte b_Value = new Byte((byte) 8);
    private static Character c_Value = new Character('a');
    private static Double d_Value = new Double(1.23456789);
    private static Float f_Value = new Float(1.234f);
    private static Integer i_Value = new Integer(1048576);
    private static Long l_Value = new Long(72057594037927936L);
    private static Short s_Value = new Short((short) 256);
}