test/tools/javac/assert/Position.java

Tue, 10 Apr 2012 08:15:25 -0700

author
ohair
date
Tue, 10 Apr 2012 08:15:25 -0700
changeset 1244
807ca8ffbeb4
parent 289
84061bd68019
child 2525
2eb010b6cb22
permissions
-rw-r--r--

7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>

     1 /*
     2  * @test  /nodynamiccopyright/
     3  * @bug 4469737
     4  * @summary Verify the source position for assertions.
     5  * @author gafter
     6  */
     9 public class Position {
    10     static public void main(String[] args) {
    11         Position.class.getClassLoader().setClassAssertionStatus("U", true);
    12         new U().main();
    13     }
    14 }
    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