langtools/test/tools/javac/varargs/warning/Warn4.java
author vromero
Tue, 08 Jan 2013 13:47:57 +0000
changeset 15040 99fd9483d3f0
parent 9087 e9e44877cd18
child 15384 5a8d00abf076
permissions -rw-r--r--
8005167: execution time of combo tests in javac should be improved Reviewed-by: jjg, jjh
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     1
/*
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     4
 *
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     8
 *
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    14
 *
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    18
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5846
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5846
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5846
diff changeset
    21
 * questions.
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    22
 */
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    23
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    24
/**
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    25
 * @test
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    26
 * @bug     6945418 6993978
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    27
 * @summary Project Coin: Simplified Varargs Method Invocation
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    28
 * @author  mcimadamore
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    29
 * @library ../../lib
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    30
 * @build JavacTestingAbstractThreadedTest
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    31
 * @run main Warn4
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    32
 */
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    33
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    34
import java.net.URI;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    35
import java.util.Arrays;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    36
import java.util.Set;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    37
import java.util.HashSet;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    38
import javax.tools.Diagnostic;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    39
import javax.tools.JavaCompiler;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    40
import javax.tools.JavaFileObject;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    41
import javax.tools.SimpleJavaFileObject;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    42
import javax.tools.ToolProvider;
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    43
import com.sun.source.util.JavacTask;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    44
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    45
public class Warn4
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    46
    extends JavacTestingAbstractThreadedTest
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    47
    implements Runnable {
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    48
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    49
    final static Warning[] error = null;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    50
    final static Warning[] none = new Warning[] {};
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    51
    final static Warning[] vararg = new Warning[] { Warning.VARARGS };
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    52
    final static Warning[] unchecked = new Warning[] { Warning.UNCHECKED };
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    53
    final static Warning[] both =
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    54
            new Warning[] { Warning.VARARGS, Warning.UNCHECKED };
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    55
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    56
    enum Warning {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    57
        UNCHECKED("generic.array.creation"),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    58
        VARARGS("varargs.non.reifiable.type");
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    59
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    60
        String key;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    61
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    62
        Warning(String key) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    63
            this.key = key;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    64
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    65
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    66
        boolean isSuppressed(TrustMe trustMe, SourceLevel source,
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    67
                SuppressLevel suppressLevelClient,
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    68
                SuppressLevel suppressLevelDecl,
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    69
                ModifierKind modKind) {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    70
            switch(this) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    71
                case VARARGS:
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    72
                    return source == SourceLevel.JDK_6 ||
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    73
                            suppressLevelDecl == SuppressLevel.UNCHECKED ||
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    74
                            trustMe == TrustMe.TRUST;
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    75
                case UNCHECKED:
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    76
                    return suppressLevelClient == SuppressLevel.UNCHECKED ||
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    77
                        (trustMe == TrustMe.TRUST && modKind !=
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
    78
                            ModifierKind.NONE && source == SourceLevel.JDK_7);
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    79
            }
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    80
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    81
            SuppressLevel supLev = this == VARARGS ?
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    82
                suppressLevelDecl :
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    83
                suppressLevelClient;
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    84
            return supLev == SuppressLevel.UNCHECKED ||
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    85
                    (trustMe == TrustMe.TRUST && modKind != ModifierKind.NONE);
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    86
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    87
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    88
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    89
    enum SourceLevel {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    90
        JDK_6("6"),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    91
        JDK_7("7");
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    92
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    93
        String sourceKey;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    94
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    95
        SourceLevel(String sourceKey) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    96
            this.sourceKey = sourceKey;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    97
        }
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
    98
    }
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
    99
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   100
    enum TrustMe {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   101
        DONT_TRUST(""),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   102
        TRUST("@java.lang.SafeVarargs");
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   103
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   104
        String anno;
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   105
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   106
        TrustMe(String anno) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   107
            this.anno = anno;
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   108
        }
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   109
    }
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   110
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   111
    enum ModifierKind {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   112
        NONE(" "),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   113
        FINAL("final "),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   114
        STATIC("static ");
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   115
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   116
        String mod;
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   117
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   118
        ModifierKind(String mod) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   119
            this.mod = mod;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   120
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   121
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   122
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   123
    enum SuppressLevel {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   124
        NONE(""),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   125
        UNCHECKED("unchecked");
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   126
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   127
        String lint;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   128
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   129
        SuppressLevel(String lint) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   130
            this.lint = lint;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   131
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   132
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   133
        String getSuppressAnno() {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   134
            return "@SuppressWarnings(\"" + lint + "\")";
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   135
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   136
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   137
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   138
    enum Signature {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   139
        UNBOUND("void #name(List<?>#arity arg) { #body }",
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   140
            new Warning[][] {none, none, none, none, error}),
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   141
        INVARIANT_TVAR("<Z> void #name(List<Z>#arity arg) { #body }",
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   142
            new Warning[][] {both, both, error, both, error}),
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   143
        TVAR("<Z> void #name(Z#arity arg) { #body }",
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   144
            new Warning[][] {both, both, both, both, vararg}),
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   145
        INVARIANT("void #name(List<String>#arity arg) { #body }",
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   146
            new Warning[][] {error, error, error, both, error}),
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   147
        UNPARAMETERIZED("void #name(String#arity arg) { #body }",
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   148
            new Warning[][] {error, error, error, error, none});
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   149
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   150
        String template;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   151
        Warning[][] warnings;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   152
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   153
        Signature(String template, Warning[][] warnings) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   154
            this.template = template;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   155
            this.warnings = warnings;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   156
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   157
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   158
        boolean isApplicableTo(Signature other) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   159
            return warnings[other.ordinal()] != null;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   160
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   161
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   162
        boolean giveUnchecked(Signature other) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   163
            return warnings[other.ordinal()] == unchecked ||
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   164
                    warnings[other.ordinal()] == both;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   165
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   166
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   167
        boolean giveVarargs(Signature other) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   168
            return warnings[other.ordinal()] == vararg ||
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   169
                    warnings[other.ordinal()] == both;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   170
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   171
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   172
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   173
    public static void main(String... args) throws Exception {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   174
        for (SourceLevel sourceLevel : SourceLevel.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   175
            for (TrustMe trustMe : TrustMe.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   176
                for (SuppressLevel suppressLevelClient : SuppressLevel.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   177
                    for (SuppressLevel suppressLevelDecl : SuppressLevel.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   178
                        for (ModifierKind modKind : ModifierKind.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   179
                            for (Signature vararg_meth : Signature.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   180
                                for (Signature client_meth : Signature.values()) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   181
                                    if (vararg_meth.isApplicableTo(client_meth)) {
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   182
                                        pool.execute(new Warn4(sourceLevel,
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   183
                                                trustMe,
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   184
                                                suppressLevelClient,
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   185
                                                suppressLevelDecl,
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   186
                                                modKind,
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   187
                                                vararg_meth,
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   188
                                                client_meth));
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   189
                                    }
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   190
                                }
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   191
                            }
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   192
                        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   193
                    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   194
                }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   195
            }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   196
        }
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   197
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   198
        checkAfterExec();
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   199
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   200
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   201
    SourceLevel sourceLevel;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   202
    TrustMe trustMe;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   203
    SuppressLevel suppressLevelClient;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   204
    SuppressLevel suppressLevelDecl;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   205
    ModifierKind modKind;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   206
    Signature vararg_meth;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   207
    Signature client_meth;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   208
    DiagnosticChecker diagChecker;
8613
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7643
diff changeset
   209
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   210
    public Warn4(SourceLevel sourceLevel, TrustMe trustMe,
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   211
            SuppressLevel suppressLevelClient, SuppressLevel suppressLevelDecl,
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   212
            ModifierKind modKind, Signature vararg_meth, Signature client_meth) {
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   213
        this.sourceLevel = sourceLevel;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   214
        this.trustMe = trustMe;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   215
        this.suppressLevelClient = suppressLevelClient;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   216
        this.suppressLevelDecl = suppressLevelDecl;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   217
        this.modKind = modKind;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   218
        this.vararg_meth = vararg_meth;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   219
        this.client_meth = client_meth;
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   220
        this.diagChecker = new DiagnosticChecker();
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   221
    }
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   222
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   223
    @Override
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   224
    public void run() {
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   225
        int id = checkCount.incrementAndGet();
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   226
        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   227
        JavaSource source = new JavaSource(id);
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   228
        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), diagChecker,
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   229
                Arrays.asList("-Xlint:unchecked", "-source", sourceLevel.sourceKey),
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   230
                null, Arrays.asList(source));
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   231
        ct.call(); //to get mandatory notes
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   232
        check(source, new boolean[] {vararg_meth.giveUnchecked(client_meth),
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   233
                               vararg_meth.giveVarargs(client_meth)});
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   234
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   235
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   236
    void check(JavaSource source, boolean[] warnArr) {
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   237
        boolean badOutput = false;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   238
        for (Warning wkind : Warning.values()) {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   239
            boolean isSuppressed = wkind.isSuppressed(trustMe, sourceLevel,
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   240
                    suppressLevelClient, suppressLevelDecl, modKind);
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   241
            System.out.println("SUPPRESSED = " + isSuppressed);
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   242
            badOutput |= (warnArr[wkind.ordinal()] && !isSuppressed) !=
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   243
                    diagChecker.warnings.contains(wkind);
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   244
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   245
        if (badOutput) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   246
            throw new Error("invalid diagnostics for source:\n" +
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   247
                    source.getCharContent(true) +
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   248
                    "\nExpected unchecked warning: " + warnArr[0] +
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   249
                    "\nExpected unsafe vararg warning: " + warnArr[1] +
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   250
                    "\nWarnings: " + diagChecker.warnings +
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   251
                    "\nSource level: " + sourceLevel);
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   252
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   253
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   254
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   255
    class JavaSource extends SimpleJavaFileObject {
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   256
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   257
        String source;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   258
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   259
        public JavaSource(int id) {
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   260
            super(URI.create(String.format("myfo:/Test%d.java", id)),
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   261
                    JavaFileObject.Kind.SOURCE);
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   262
            String meth1 = vararg_meth.template.replace("#arity", "...");
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   263
            meth1 = meth1.replace("#name", "m");
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   264
            meth1 = meth1.replace("#body", "");
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   265
            meth1 = trustMe.anno + "\n" + suppressLevelDecl.getSuppressAnno() +
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   266
                    modKind.mod + meth1;
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   267
            String meth2 = client_meth.template.replace("#arity", "");
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   268
            meth2 = meth2.replace("#name", "test");
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   269
            meth2 = meth2.replace("#body", "m(arg);");
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   270
            meth2 = suppressLevelClient.getSuppressAnno() + meth2;
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   271
            source = String.format("import java.util.List;\n" +
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   272
                     "class Test%s {\n %s \n %s \n } \n", id, meth1, meth2);
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   273
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   274
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   275
        @Override
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   276
        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   277
            return source;
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   278
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   279
    }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   280
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   281
    static class DiagnosticChecker
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   282
        implements javax.tools.DiagnosticListener<JavaFileObject> {
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   283
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   284
        Set<Warning> warnings = new HashSet<>();
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   285
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   286
        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   287
            if (diagnostic.getKind() == Diagnostic.Kind.MANDATORY_WARNING ||
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   288
                    diagnostic.getKind() == Diagnostic.Kind.WARNING) {
7643
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   289
                if (diagnostic.getCode().contains(Warning.VARARGS.key)) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   290
                    warnings.add(Warning.VARARGS);
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   291
                } else if(diagnostic.getCode().contains(Warning.UNCHECKED.key)) {
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   292
                    warnings.add(Warning.UNCHECKED);
a067a0cda531 6993978: Project Coin: Compiler support of annotation to reduce varargs warnings
mcimadamore
parents: 5847
diff changeset
   293
                }
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   294
            }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   295
        }
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   296
    }
15040
99fd9483d3f0 8005167: execution time of combo tests in javac should be improved
vromero
parents: 9087
diff changeset
   297
5846
6df0e6bcb388 6945418: Project Coin: Simplified Varargs Method Invocation
mcimadamore
parents:
diff changeset
   298
}