1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/assert/Position.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,28 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 4469737 1.7 + * @summary Verify the source position for assertions. 1.8 + * @author gafter 1.9 + */ 1.10 + 1.11 + 1.12 +public class Position { 1.13 + static public void main(String[] args) { 1.14 + Position.class.getClassLoader().setClassAssertionStatus("U", true); 1.15 + new U().main(); 1.16 + } 1.17 +} 1.18 + 1.19 + 1.20 +class U { 1.21 + void main() { 1.22 + try { 1.23 + assert false; // line 20 1.24 + } catch (Throwable t) { 1.25 + if (t.getStackTrace()[0].getLineNumber() == 20) { 1.26 + return; // passed 1.27 + } 1.28 + } 1.29 + throw new Error("failed 4469737"); 1.30 + } 1.31 +}