test/langtools/tools/javac/processing/warnings/LintProcessing/TestAnnotationsWithoutProcessors.java
author darcy
Wed, 18 Jul 2018 00:16:37 -0700
changeset 51176 0d02393d9115
permissions -rw-r--r--
8193214: Incorrect annotations.without.processors warnings with JDK 9 Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51176
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     1
/*
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     4
 *
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     8
 *
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    13
 * accompanied this code).
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    14
 *
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    18
 *
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    21
 * questions.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    22
 */
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    23
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    24
/*
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    25
 * @test
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    26
 * @bug 8193214
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    27
 * @summary Verify annotations without processors warning not given for base module annotations.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    28
 * @library /tools/javac/lib
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    29
 * @modules java.compiler
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    30
 * @build JavacTestingAbstractProcessor TestAnnotationsWithoutProcessors
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    31
 * @compile/ref=empty.out -XDrawDiagnostics -Xlint:processing -processor TestAnnotationsWithoutProcessors --release 8 TestAnnotationsWithoutProcessors.java
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    32
 * @compile/ref=empty.out -XDrawDiagnostics -Xlint:processing -processor TestAnnotationsWithoutProcessors TestAnnotationsWithoutProcessors.java
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    33
 */
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    34
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    35
import java.lang.annotation.*;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    36
import java.util.*;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    37
import javax.annotation.processing.*;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    38
import javax.lang.model.element.*;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    39
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    40
/**
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    41
 * Use various annotations in java.base.
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    42
 */
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    43
@SuppressWarnings("unchecked")
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    44
public class TestAnnotationsWithoutProcessors extends JavacTestingAbstractProcessor {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    45
    @Override
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    46
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    47
        return false;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    48
    }
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    49
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    50
    @SafeVarargs
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    51
    @Deprecated
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    52
    public static void main(String... args) {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    53
        return;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    54
    }
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    55
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    56
    @FunctionalInterface
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    57
    interface OneMethod {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    58
        String method();
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    59
    }
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    60
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    61
    @Native
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    62
    public double TAU = 2.0 * Math.PI;
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    63
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    64
    @Documented
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    65
    @Inherited
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    66
    @Repeatable(TestAnnotationTypes.class)
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    67
    @Retention(RetentionPolicy.RUNTIME)
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    68
    @Target(ElementType.TYPE)
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    69
    @interface TestAnnotationType {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    70
    }
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    71
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    72
    @Documented
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    73
    @Inherited
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    74
    @Retention(RetentionPolicy.RUNTIME)
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    75
    @Target(ElementType.TYPE)
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    76
    @interface TestAnnotationTypes {
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    77
        TestAnnotationType[] value();
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    78
    }
0d02393d9115 8193214: Incorrect annotations.without.processors warnings with JDK 9
darcy
parents:
diff changeset
    79
}