test/tools/javac/resolve/Candidate.java

changeset 0
959103a6100f
equal deleted inserted replaced
-1:000000000000 0:959103a6100f
1 /*
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 import java.lang.annotation.ElementType;
24 import java.lang.annotation.Target;
25
26 @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
27 @interface Candidate {
28 /**
29 * the candidate position (line/col of the method call for which this candidate
30 * is a potential overload candidate)
31 */
32 Pos pos() default @Pos(userDefined=false);
33 /**
34 * resolution phases for which this candidate is applicable
35 */
36 Phase[] applicable() default { };
37 /**
38 * is this candidate the most specific (in the resolution phases for which it
39 * is also applicable)
40 */
41 boolean mostSpecific() default false;
42 /**
43 * this candidate inferred signature (in the resolution phases for which it
44 * is also applicable, in case it corresponds to a generic method)
45 */
46 String sig() default "";
47 }
48
49 enum Phase {
50 BASIC("BASIC"),
51 BOX("BOX"),
52 VARARGS("VARARITY");
53
54 final String javacString;
55
56 private Phase(String javacString) {
57 this.javacString = javacString;
58 }
59
60 static Phase fromString(String s) {
61 for (Phase phase : Phase.values()) {
62 if (phase.javacString.equals(s)) {
63 return phase;
64 }
65 }
66 throw new AssertionError("Invalid resolution phase string " + s);
67 }
68 }

mercurial