test/tools/javac/assert/Position.java

Mon, 29 Sep 2008 12:00:29 +0100

author
mcimadamore
date
Mon, 29 Sep 2008 12:00:29 +0100
changeset 122
1a9276e7cb18
parent 1
9a66ca7c79fa
child 289
84061bd68019
permissions
-rw-r--r--

6747671: -Xlint:rawtypes
Summary: add an Xlint option for detecting all raw types usages (ccc-approved)
Reviewed-by: jjg

     1 /*
     2  * @test  /nodynamiccopyright/
     3  * @bug 4469737
     4  * @summary Verify the source position for assertions.
     5  * @author gafter
     6  *
     7  * @compile -source 1.4 Position.java
     8  * @run main Position
     9  */
    11 public class Position {
    12     static public void main(String[] args) {
    13         Position.class.getClassLoader().setClassAssertionStatus("U", true);
    14         new U().main();
    15     }
    16 }
    17 class U {
    18     void main() {
    19         try {
    20             assert false; // line 20
    21         } catch (Throwable t) {
    22             if (t.getStackTrace()[0].getLineNumber() == 20) {
    23                 return; // passed
    24             }
    25         }
    26         throw new Error("failed 4469737");
    27     }
    28 }

mercurial