langtools/test/tools/javac/varargs/6199075/T6199075.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 27319 030080f03e4f
child 30846 2b3f379840f0
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27319
diff changeset
     2
 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     4
 *
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     8
 *
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    14
 *
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    18
 *
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    21
 * questions.
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    22
 */
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    23
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    24
/*
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    25
 * @test
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    26
 * @bug 6199075
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    27
 *
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    28
 * @summary Unambiguous varargs method calls flagged as ambiguous
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    29
 * @author mcimadamore
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    30
 *
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27319
diff changeset
    31
 * @modules jdk.compiler/com.sun.tools.classfile
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27319
diff changeset
    32
 *          jdk.compiler/com.sun.tools.javac.api
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27319
diff changeset
    33
 *          jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27319
diff changeset
    34
 *          jdk.compiler/com.sun.tools.javac.util
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    35
 */
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    36
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    37
import com.sun.source.util.JavacTask;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    38
import com.sun.tools.classfile.Instruction;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    39
import com.sun.tools.classfile.Attribute;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    40
import com.sun.tools.classfile.ClassFile;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    41
import com.sun.tools.classfile.Code_attribute;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    42
import com.sun.tools.classfile.ConstantPool.*;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    43
import com.sun.tools.classfile.Method;
8613
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
    44
import com.sun.tools.javac.api.JavacTool;
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    45
import com.sun.tools.javac.util.List;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    46
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    47
import java.io.File;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    48
import java.net.URI;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    49
import java.util.Arrays;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    50
import java.util.Locale;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    51
import javax.tools.Diagnostic;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    52
import javax.tools.JavaCompiler;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    53
import javax.tools.JavaFileObject;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    54
import javax.tools.SimpleJavaFileObject;
8613
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
    55
import javax.tools.StandardJavaFileManager;
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    56
import javax.tools.ToolProvider;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    57
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    58
public class T6199075 {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    59
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    60
    int checkCount = 0;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    61
    int bytecodeCheckCount = 0;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    62
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    63
    enum TypeKind {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    64
        BYTE("byte", "(byte)1", "[B", 0),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    65
        CHAR("char", "'c'", "[C", 1),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    66
        SHORT("short", "(short)1", "[S", 2),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    67
        INT("int", "1", "[I", 3),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    68
        LONG("long", "1L", "[J", 4),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    69
        FLOAT("float", "1.0F", "[F", 5),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    70
        DOUBLE("double", "1.0D", "[D", 6),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    71
        BOOLEAN("boolean", "true", "[Z", -1);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    72
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    73
        String typeString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    74
        String valueString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    75
        String bytecodeString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    76
        private int subtypeTag;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    77
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    78
        TypeKind(String typeString, String valueString, String bytecodeString, int subtypeTag) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    79
            this.typeString = typeString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    80
            this.valueString = valueString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    81
            this.bytecodeString = bytecodeString;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    82
            this.subtypeTag = subtypeTag;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    83
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    84
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    85
        boolean isSubtypeOf(TypeKind that) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    86
            switch (this) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    87
                case BOOLEAN:
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    88
                    return that == BOOLEAN;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    89
                case BYTE:
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    90
                case CHAR:
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    91
                    return this.subtypeTag == that.subtypeTag ||
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    92
                            this.subtypeTag + 2 <= that.subtypeTag;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    93
                default:
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    94
                    return this.subtypeTag <= that.subtypeTag;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    95
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    96
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    97
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    98
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
    99
    enum ArgumentsArity {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   100
        ZERO(0),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   101
        ONE(1),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   102
        TWO(2),
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   103
        THREE(3);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   104
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   105
        int arity;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   106
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   107
        ArgumentsArity(int arity) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   108
            this.arity = arity;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   109
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   110
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   111
        String asExpressionList(TypeKind type) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   112
            StringBuilder buf = new StringBuilder();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   113
            String sep = "";
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   114
            for (int i = 0; i < arity; i++) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   115
                buf.append(sep);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   116
                buf.append(type.valueString);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   117
                sep = ",";
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   118
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   119
            return buf.toString();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   120
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   121
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   122
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   123
    static class VarargsMethod {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   124
        TypeKind varargsElement;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   125
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   126
        VarargsMethod(TypeKind varargsElement) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   127
            this.varargsElement = varargsElement;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   128
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   129
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   130
        @Override
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   131
        public String toString() {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   132
            return "void m("+ varargsElement.typeString+ "... args) {}";
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   133
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   134
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   135
        boolean isApplicable(TypeKind actual, ArgumentsArity argsArity) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   136
            return argsArity == ArgumentsArity.ZERO ||
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   137
                    actual.isSubtypeOf(varargsElement);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   138
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   139
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   140
        boolean isMoreSpecificThan(VarargsMethod that) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   141
            return varargsElement.isSubtypeOf(that.varargsElement);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   142
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   143
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   144
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   145
    public static void main(String... args) throws Exception {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   146
        new T6199075().test();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   147
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   148
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   149
    void test() throws Exception {
27319
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   150
        try {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   151
            for (TypeKind formal1 : TypeKind.values()) {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   152
                VarargsMethod m1 = new VarargsMethod(formal1);
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   153
                for (TypeKind formal2 : TypeKind.values()) {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   154
                    VarargsMethod m2 = new VarargsMethod(formal2);
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   155
                    for (TypeKind actual : TypeKind.values()) {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   156
                        for (ArgumentsArity argsArity : ArgumentsArity.values()) {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   157
                            compileAndCheck(m1, m2, actual, argsArity);
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   158
                        }
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   159
                    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   160
                }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   161
            }
27319
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   162
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   163
            System.out.println("Total checks made: " + checkCount);
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   164
            System.out.println("Bytecode checks made: " + bytecodeCheckCount);
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   165
        } finally {
030080f03e4f 8062348: langtools tests should close file manager (group 1)
jjg
parents: 9087
diff changeset
   166
            fm.close();
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   167
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   168
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   169
8613
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
   170
    // Create a single file manager and reuse it for each compile to save time.
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
   171
    StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
   172
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   173
    void compileAndCheck(VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) throws Exception {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   174
        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   175
        JavaSource source = new JavaSource(m1, m2, actual, argsArity);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   176
        ErrorChecker ec = new ErrorChecker();
8613
d8e9b6d6ccee 7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
jjh
parents: 7635
diff changeset
   177
        JavacTask ct = (JavacTask)tool.getTask(null, fm, ec,
7635
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   178
                null, null, Arrays.asList(source));
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   179
        ct.generate();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   180
        check(source, ec, m1, m2, actual, argsArity);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   181
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   182
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   183
    void check(JavaSource source, ErrorChecker ec, VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   184
        checkCount++;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   185
        boolean resolutionError = false;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   186
        VarargsMethod selectedMethod = null;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   187
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   188
        boolean m1_applicable = m1.isApplicable(actual, argsArity);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   189
        boolean m2_applicable = m2.isApplicable(actual, argsArity);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   190
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   191
        if (!m1_applicable && !m2_applicable) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   192
            resolutionError = true;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   193
        } else if (m1_applicable && m2_applicable) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   194
            //most specific
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   195
            boolean m1_moreSpecific = m1.isMoreSpecificThan(m2);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   196
            boolean m2_moreSpecific = m2.isMoreSpecificThan(m1);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   197
            resolutionError = m1_moreSpecific == m2_moreSpecific;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   198
            selectedMethod = m1_moreSpecific ? m1 : m2;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   199
        } else {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   200
            selectedMethod = m1_applicable ?
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   201
                m1 : m2;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   202
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   203
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   204
        if (ec.errorFound != resolutionError) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   205
            throw new Error("invalid diagnostics for source:\n" +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   206
                    source.getCharContent(true) +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   207
                    "\nExpected resolution error: " + resolutionError +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   208
                    "\nFound error: " + ec.errorFound +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   209
                    "\nCompiler diagnostics:\n" + ec.printDiags());
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   210
        } else if (!resolutionError) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   211
            verifyBytecode(selectedMethod);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   212
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   213
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   214
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   215
    void verifyBytecode(VarargsMethod selected) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   216
        bytecodeCheckCount++;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   217
        File compiledTest = new File("Test.class");
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   218
        try {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   219
            ClassFile cf = ClassFile.read(compiledTest);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   220
            Method testMethod = null;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   221
            for (Method m : cf.methods) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   222
                if (m.getName(cf.constant_pool).equals("test")) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   223
                    testMethod = m;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   224
                    break;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   225
                }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   226
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   227
            if (testMethod == null) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   228
                throw new Error("Test method not found");
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   229
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   230
            Code_attribute ea = (Code_attribute)testMethod.attributes.get(Attribute.Code);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   231
            if (testMethod == null) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   232
                throw new Error("Code attribute for test() method not found");
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   233
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   234
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   235
            for (Instruction i : ea.getInstructions()) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   236
                if (i.getMnemonic().equals("invokevirtual")) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   237
                    int cp_entry = i.getUnsignedShort(1);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   238
                    CONSTANT_Methodref_info methRef =
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   239
                            (CONSTANT_Methodref_info)cf.constant_pool.get(cp_entry);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   240
                    String type = methRef.getNameAndTypeInfo().getType();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   241
                    if (!type.contains(selected.varargsElement.bytecodeString)) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   242
                        throw new Error("Unexpected type method call: " + type);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   243
                    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   244
                    break;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   245
                }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   246
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   247
        } catch (Exception e) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   248
            e.printStackTrace();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   249
            throw new Error("error reading " + compiledTest +": " + e);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   250
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   251
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   252
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   253
    static class JavaSource extends SimpleJavaFileObject {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   254
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   255
        static final String source_template = "class Test {\n" +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   256
                "   #V1\n" +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   257
                "   #V2\n" +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   258
                "   void test() { m(#E); }\n" +
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   259
                "}";
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   260
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   261
        String source;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   262
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   263
        public JavaSource(VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   264
            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   265
            source = source_template.replaceAll("#V1", m1.toString()).
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   266
                    replaceAll("#V2", m2.toString()).
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   267
                    replaceAll("#E", argsArity.asExpressionList(actual));
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   268
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   269
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   270
        @Override
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   271
        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   272
            return source;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   273
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   274
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   275
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   276
    static class ErrorChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   277
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   278
        boolean errorFound;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   279
        List<String> errDiags = List.nil();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   280
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   281
        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   282
            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   283
                errDiags = errDiags.append(diagnostic.getMessage(Locale.getDefault()));
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   284
                errorFound = true;
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   285
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   286
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   287
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   288
        String printDiags() {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   289
            StringBuilder buf = new StringBuilder();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   290
            for (String s : errDiags) {
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   291
                buf.append(s);
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   292
                buf.append("\n");
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   293
            }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   294
            return buf.toString();
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   295
        }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   296
    }
e0a3aeefe4e7 6199075: Unambiguous varargs method calls flagged as ambiguous
mcimadamore
parents:
diff changeset
   297
}