langtools/test/tools/javac/assert/Position.java
author jlahoda
Thu, 09 Oct 2014 10:08:52 +0200
changeset 26993 513b2cae81c3
parent 2985 f43e1241e7fb
permissions -rw-r--r--
8057652: Request to improve error messages for labeled declarations Summary: Parse labeled statements as block statements to improve error recovery for labeled declarations; related cleanup. Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4469737
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Verify the source position for assertions.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author gafter
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
2985
f43e1241e7fb 6843761: Update langtools tests to remove unncessary -source and -target options
darcy
parents: 10
diff changeset
     8
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
public class Position {
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
    static public void main(String[] args) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
        Position.class.getClassLoader().setClassAssertionStatus("U", true);
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
        new U().main();
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
}
2985
f43e1241e7fb 6843761: Update langtools tests to remove unncessary -source and -target options
darcy
parents: 10
diff changeset
    15
f43e1241e7fb 6843761: Update langtools tests to remove unncessary -source and -target options
darcy
parents: 10
diff changeset
    16
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
class U {
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
    void main() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
            assert false; // line 20
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        } catch (Throwable t) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
            if (t.getStackTrace()[0].getLineNumber() == 20) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
                return; // passed
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
        throw new Error("failed 4469737");
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
}