File: TestPrintln.java

package info (click to toggle)
checker-framework-java 3.0.1%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,736 kB
  • sloc: java: 145,286; xml: 785; sh: 456; makefile: 401; perl: 26
file content (22 lines) | stat: -rw-r--r-- 913 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
// Test case for issue #2366:
// https://github.com/typetools/checker-framework/issues/2366

import org.checkerframework.checker.signedness.qual.*;

public class TestPrintln {
    public static void main(String[] args) {
        // The first call produces the intended result, but the next two do not.
        // The Signedness Checker conservatively warns about all three, because it does not analyze
        // the specific values returned by parseUnsignedInt.

        @Unsigned int a = Integer.parseUnsignedInt("2147483647");
        // :: error: (argument.type.incompatible)
        System.out.println(a);
        @Unsigned int b = Integer.parseUnsignedInt("2147483648");
        // :: error: (argument.type.incompatible)
        System.out.println(b);
        @Unsigned int c = Integer.parseUnsignedInt("4000000000");
        // :: error: (argument.type.incompatible)
        System.out.println(c);
    }
}