langtools/test/tools/javac/varargs/warning/Warn6.java
author jlahoda
Fri, 23 Jan 2015 15:14:53 +0100
changeset 28594 f462f1662741
permissions -rw-r--r--
8069254: Warning issued despite @SafeVarargs annotation on constructor Summary: The Symbol created for diamond inference does not have annotations attached - need to look for @SafeVarargs on the underlying constructor's Symbol. Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28594
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     1
/*
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     4
 *
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     8
 *
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    14
 *
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    18
 *
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    21
 * questions.
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    22
 */
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    23
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    24
/**
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    25
 * @test
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    26
 * @bug 8069254
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    27
 * @summary Ensure the generic array creation warning is not incorrectly produced for diamonds
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    28
 * @compile -Xlint:unchecked -Werror Warn6.java
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    29
 */
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    30
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    31
public class Warn6<T> {
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    32
    @SafeVarargs
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    33
    public Warn6(T... args) {
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    34
    }
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    35
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    36
    public static void main(String[] args) {
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    37
        Iterable<String> i = null;
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    38
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    39
        Warn6<Iterable<String>> foo2 = new Warn6<>(i, i);
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    40
        Warn6<Iterable<String>> foo3 = new Warn6<Iterable<String>>(i, i);
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    41
    }
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    42
}
f462f1662741 8069254: Warning issued despite @SafeVarargs annotation on constructor
jlahoda
parents:
diff changeset
    43