blob: 58d63bc9bd08e4b00512d2aadec9aecfef74fcc9 [file] [log] [blame]
/**
* @test /nodynamiccopyright/
* @bug 8021112
* @summary Verify that \\@SuppressWarnings("unchecked") works for type annotations
* @build VerifySuppressWarnings
* @compile/ref=TypeAnnotations.out -XDrawDiagnostics -Xlint:unchecked,deprecation,cast TypeAnnotations.java
* @run main VerifySuppressWarnings TypeAnnotations.java
*/
import java.lang.annotation.*;
public class TypeAnnotations extends @TA Object implements @TA Runnable {
public @TA String @TA [] m(@TA String @TA [] p) throws @TA Throwable {
Runnable r = () -> {
@TA Object tested = null;
@TA boolean isAnnotated = tested instanceof @TA String;
};
@TA Object tested = null;
@TA boolean isAnnotated = tested instanceof @TA String;
return (@TA String @TA []) null;
}
{
Runnable r = () -> {
@TA Object tested = null;
@TA boolean isAnnotated = tested instanceof @TA String;
};
@TA Object tested = null;
@TA boolean isAnnotated = tested instanceof @TA String;
@TA String @TA [] ret = (@TA String @TA []) null;
}
@TA String @TA [] f = new @TA String @TA[0];
@Override public void run() { }
public static class Inner extends @TA Object implements @TA Runnable {
@Override public void run() { }
}
}
@Target({ElementType.TYPE_USE, ElementType.TYPE})
@Deprecated
@interface TA {
}