File: CompoundAssignments.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,840 kB
  • sloc: java: 145,910; xml: 839; sh: 518; makefile: 401; perl: 26
file content (23 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class CompoundAssignments {
    static final int SIZE = 4;

    // There used to be a bug creating the LeftShiftAssignmentNode
    // where the target (e.g. pow) was replaced by the shift amount
    // (e.g. 1).
    static void left_shift_assign() {
        for (int i = 0, pow = 1; i <= SIZE; i++) {
            pow <<= 1;
        }
    }

    // There used to be a bug computing the Receiver for a widening
    // conversion, such as widening sum to a double below.
    static int sum_with_widening() {
        double[] freq = new double[SIZE];
        int sum = 0;
        for (int i = 0; i < SIZE; i++) {
            sum += freq[i];
        }
        return sum;
    }
}