/**
* @test/nodynamiccopyright/
* @bug 4952629 4870514
* @summary REGRESSION: javac generates a spurious line number entry on } else {
*
* @author jjh
*
* @run build VMConnection TargetListener TargetAdapter
* @run compile -g LineNumberOnBraceTest.java
* @run main LineNumberOnBraceTest
*/
/********** LINE NUMBER SENSITIVE! *****************************************************************/
class LineNumberOnBraceTarg {
} else {
}
boolean b1 = false;
if (b1) { // stopLine2
}
} else {
}
}
// This isn't part of the test; it is just here
// so one can see what line numbers are generated for a finally.
public void exampleOfThrow() {
try {
throw new Exception();
} catch (Exception e) {
} finally {
}
}
}
/********** test program **********/
super(args);
}
}
/********** test core **********/
/*
* Get to the top of main()
* to determine targetClass and mainThread
*/
// Bug 4952629 is that javac outputs a line number
// on the goto around the else which causes us to
// be stopped at that goto instead of the println("Goodbye ...")
failure("FAIL: Bug 4952629: Should be at line " +
", am at " + ln);
} else {
}
// Test for bug 4870514
failure("FAIL: bug 4870514: Incorrectly stopped at " +
} else {
}
/*
* resume the target listening for events
*/
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("LineNumberOnBraceTest: passed");
} else {
throw new Exception("LineNumberOnBraceTest: failed");
}
}
}