langtools/test/tools/javac/assert/DU1.java
author duke
Wed, 05 Jul 2017 23:01:50 +0200 (2017-07-05)
changeset 44228 e46434c65a2b
parent 25310 a2e7f254f886
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
25310
a2e7f254f886 8046770: .out files for assert, boxing, and overload tests in tools/javac dir
sogoel
parents: 5520
diff changeset
     2
 * @test /nodynamiccopyright/
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4468510
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Check correct DU computation for assertions.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author gafter
25310
a2e7f254f886 8046770: .out files for assert, boxing, and overload tests in tools/javac dir
sogoel
parents: 5520
diff changeset
     6
 * @compile/fail/ref=DU1.out -XDrawDiagnostics  DU1.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
class DU1 {
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
    void f1() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
        final int i;
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
            assert false : i=3;
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
        } catch (AssertionError ae) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
        i=4; // error
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
}