File: TestPrintln.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; 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);
    }
}