|
Java example source code file (TypeAnnotations.java)
The TypeAnnotations.java Java example source code/** * @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 { } Other Java examples (source code examples)Here is a short list of links related to this Java TypeAnnotations.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.