test/langtools/tools/javac/warnings/Deprecation.java
author jlahoda
Wed, 07 Feb 2018 16:49:24 +0100
changeset 48776 107413b070b9
parent 47216 71c04702a3d5
permissions -rw-r--r--
8194764: javac incorrectly flags deprecated for removal imports Summary: Fixing source range for the Source.Feature.DEPRECATE_ON_IMPORT Reviewed-by: mcimadamore

/**
 * @test  /nodynamiccopyright/
 * @bug 4986256 6598104 8032211 8194764
 * @compile/ref=Deprecation.noLint.out                                                 -XDrawDiagnostics Deprecation.java
 * @compile/ref=Deprecation.lintDeprecation.out  -Xlint:deprecation                    -XDrawDiagnostics Deprecation.java
 * @compile/ref=Deprecation.lintDeprecation.out  -Xlint:deprecation,-options -source 9 -XDrawDiagnostics Deprecation.java
 * @compile/ref=Deprecation.lintDeprecation8.out -Xlint:deprecation,-options -source 8 -XDrawDiagnostics Deprecation.java
 */

import java.io.StringBufferInputStream;

@Deprecated
class Deprecation
{
}

// control: this class should generate warnings
class Deprecation2
{
    void m() {
        Object d = new Deprecation();
    }
}

// tests: the warnings that would otherwise be generated should all be suppressed
@SuppressWarnings("deprecation")
class Deprecation3
{
    void m() {
        Object d = new Deprecation();
    }
}

class Deprecation4
{
    @SuppressWarnings("deprecation")
    void m() {
        Object d = new Deprecation();
    }
}

class Deprecation5
{
    void m() {
        @SuppressWarnings("deprecation")
            class Inner {
                void m() {
                    Object d = new Deprecation();
                }
            }
    }
}

// this class should produce warnings because @SuppressWarnings should not be inherited
class Deprecation6 extends Deprecation3
{
    void m() {
        Object d = new Deprecation();
    }
}