0N/A * @test /nodynamiccopyright/ 0N/A * @bug 4216683 4346296 4656556 4785453 0N/A * @summary New rules for when deprecation messages are suppressed 0N/A/* Test for the contexts in which deprecations warnings should 0N/A * (and should not) be given. They should be given when 0N/A * o invoking a deprecated method from a non-deprecated one. 0N/A * o new X() using a deprecated constructor 0N/A * o super() to a deprecated constructor 0N/A * o extending a deprecated class. 0N/A * But deprecation messages are suppressed as follows: 0N/A * o Never complain about code in the same outermost class as 0N/A * the deprecated entity. 0N/A * o Extending a deprecated class with a deprecated one is OK. 0N/A * o Overriding a deprecated method with a deprecated one is OK. 0N/A * o Code appearing in a deprecated class is OK. 0N/A void g() {
// error (1) 0N/A super.g();
// error (2) 0N/A super(i);
// error (5) 0N/Aclass V
extends T {}
// error (6) 0N/Aclass W
extends T {
// ok - inside deprecated class 0N/A new T(
1.3f).g();
// ok - called from deprecated static block 0N/A new T(
1.3f).g();
// ok - called from deprecated block 0N/A new T(
1.3f).g();
// ok - inside deprecated class 0N/A int x =
calcx();
// ok - inside deprecated class 0N/Aclass Y
extends X {}
// ok - not overriding anything