test/tools/javac/jvm/T7024096.java

Thu, 21 Feb 2013 15:26:46 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:26:46 +0000
changeset 1599
9f0ec00514b6
parent 0
959103a6100f
permissions
-rw-r--r--

8007461: Regression: bad overload resolution when inner class and outer class have method with same name
Summary: Fix regression in varargs method resolution introduced by bad refactoring
Reviewed-by: jjg

aoqi@0 1 /*
aoqi@0 2 * @test /nodynamiccopyright/
aoqi@0 3 * @bug 7024096
aoqi@0 4 * @summary Stack trace has invalid line numbers
aoqi@0 5 * @author Bruce Chapman
aoqi@0 6 * @compile T7024096.java
aoqi@0 7 * @run main T7024096
aoqi@0 8 */
aoqi@0 9
aoqi@0 10 public class T7024096 {
aoqi@0 11 private static final int START = 14; // starting line number for the test
aoqi@0 12 public static void main(String[] args) {
aoqi@0 13 T7024096 m = new T7024096();
aoqi@0 14 m.nest(START);
aoqi@0 15 m.nest(START + 1, m.nest(START + 1), m.nest(START + 1),
aoqi@0 16 m.nest(START + 2),
aoqi@0 17 m.nest(START + 3, m.nest(START + 3)));
aoqi@0 18 }
aoqi@0 19
aoqi@0 20 public T7024096 nest(int expectedline, T7024096... args) {
aoqi@0 21 Exception e = new Exception("expected line#: " + expectedline);
aoqi@0 22 int myline = e.getStackTrace()[1].getLineNumber();
aoqi@0 23 if( myline != expectedline) {
aoqi@0 24 throw new RuntimeException("Incorrect line number " +
aoqi@0 25 "expected: " + expectedline +
aoqi@0 26 ", got: " + myline, e);
aoqi@0 27 }
aoqi@0 28 System.out.format("Got expected line number %d correct %n", myline);
aoqi@0 29 return null;
aoqi@0 30 }
aoqi@0 31 }

mercurial