author | vromero |
Wed, 23 Jan 2013 20:57:40 +0000 | |
changeset 15384 | 5a8d00abf076 |
parent 15040 | 99fd9483d3f0 |
child 18008 | 6d75e3886bac |
permissions | -rw-r--r-- |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
1 |
/* |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
2 |
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
4 |
* |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
8 |
* |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
13 |
* accompanied this code). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
14 |
* |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
18 |
* |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
21 |
* questions. |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
22 |
*/ |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
23 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
24 |
/* |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
25 |
* @test |
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
26 |
* @bug 7062745 8006694 |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
27 |
* @summary Regression: difference in overload resolution when two methods |
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
28 |
* are maximally specific |
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
29 |
* temporarily workaround combo tests are causing time out in several platforms |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
30 |
* @library ../../../lib |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
31 |
* @build JavacTestingAbstractThreadedTest |
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
32 |
* @run main/othervm GenericOverrideTest |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
33 |
*/ |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
34 |
|
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
35 |
// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047) |
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
36 |
// see JDK-8006746 |
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15040
diff
changeset
|
37 |
|
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
38 |
import java.net.URI; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
39 |
import java.util.Arrays; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
40 |
import javax.tools.Diagnostic; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
41 |
import javax.tools.JavaFileObject; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
42 |
import javax.tools.SimpleJavaFileObject; |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
43 |
import com.sun.source.util.JavacTask; |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
44 |
|
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
45 |
public class GenericOverrideTest |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
46 |
extends JavacTestingAbstractThreadedTest |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
47 |
implements Runnable { |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
48 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
49 |
enum SignatureKind { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
50 |
NON_GENERIC(""), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
51 |
GENERIC("<X>"); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
52 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
53 |
String paramStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
54 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
55 |
private SignatureKind(String paramStr) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
56 |
this.paramStr = paramStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
57 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
58 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
59 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
60 |
enum ReturnTypeKind { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
61 |
LIST("List"), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
62 |
ARRAYLIST("ArrayList"); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
63 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
64 |
String retStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
65 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
66 |
private ReturnTypeKind(String retStr) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
67 |
this.retStr = retStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
68 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
69 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
70 |
boolean moreSpecificThan(ReturnTypeKind that) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
71 |
switch (this) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
72 |
case LIST: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
73 |
return that == this; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
74 |
case ARRAYLIST: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
75 |
return that == LIST || that == ARRAYLIST; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
76 |
default: throw new AssertionError("Unexpected ret kind: " + this); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
77 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
78 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
79 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
80 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
81 |
enum TypeArgumentKind { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
82 |
NONE(""), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
83 |
UNBOUND("<?>"), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
84 |
INTEGER("<Number>"), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
85 |
NUMBER("<Integer>"), |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
86 |
TYPEVAR("<X>"); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
87 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
88 |
String typeargStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
89 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
90 |
private TypeArgumentKind(String typeargStr) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
91 |
this.typeargStr = typeargStr; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
92 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
93 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
94 |
boolean compatibleWith(SignatureKind sig) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
95 |
switch (this) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
96 |
case TYPEVAR: return sig != SignatureKind.NON_GENERIC; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
97 |
default: return true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
98 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
99 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
100 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
101 |
boolean moreSpecificThan(TypeArgumentKind that, boolean strict) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
102 |
switch (this) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
103 |
case NONE: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
104 |
return that == this || !strict; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
105 |
case UNBOUND: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
106 |
return that == this || that == NONE; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
107 |
case INTEGER: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
108 |
case NUMBER: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
109 |
case TYPEVAR: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
110 |
return that == this || that == NONE || that == UNBOUND; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
111 |
default: throw new AssertionError("Unexpected typearg kind: " + this); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
112 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
113 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
114 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
115 |
boolean assignableTo(TypeArgumentKind that, SignatureKind sig) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
116 |
switch (this) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
117 |
case NONE: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
118 |
//this case needs to workaround to javac's impl of 15.12.2.8 being too strict |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
119 |
//ideally should be just 'return true' (see 7067746) |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
120 |
return sig == SignatureKind.NON_GENERIC || that == NONE; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
121 |
case UNBOUND: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
122 |
return that == this || that == NONE; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
123 |
case INTEGER: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
124 |
case NUMBER: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
125 |
return that == this || that == NONE || that == UNBOUND; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
126 |
case TYPEVAR: |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
127 |
return true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
128 |
default: throw new AssertionError("Unexpected typearg kind: " + this); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
129 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
130 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
131 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
132 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
133 |
public static void main(String... args) throws Exception { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
134 |
for (SignatureKind sig1 : SignatureKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
135 |
for (ReturnTypeKind rt1 : ReturnTypeKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
136 |
for (TypeArgumentKind ta1 : TypeArgumentKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
137 |
if (!ta1.compatibleWith(sig1)) continue; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
138 |
for (SignatureKind sig2 : SignatureKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
139 |
for (ReturnTypeKind rt2 : ReturnTypeKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
140 |
for (TypeArgumentKind ta2 : TypeArgumentKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
141 |
if (!ta2.compatibleWith(sig2)) continue; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
142 |
for (ReturnTypeKind rt3 : ReturnTypeKind.values()) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
143 |
for (TypeArgumentKind ta3 : TypeArgumentKind.values()) { |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
144 |
if (!ta3.compatibleWith(SignatureKind.NON_GENERIC)) |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
145 |
continue; |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
146 |
pool.execute( |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
147 |
new GenericOverrideTest(sig1, |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
148 |
rt1, ta1, sig2, rt2, |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
149 |
ta2, rt3, ta3)); |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
150 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
151 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
152 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
153 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
154 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
155 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
156 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
157 |
} |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
158 |
|
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
159 |
checkAfterExec(); |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
160 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
161 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
162 |
SignatureKind sig1, sig2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
163 |
ReturnTypeKind rt1, rt2, rt3; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
164 |
TypeArgumentKind ta1, ta2, ta3; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
165 |
JavaSource source; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
166 |
DiagnosticChecker diagChecker; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
167 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
168 |
GenericOverrideTest(SignatureKind sig1, ReturnTypeKind rt1, TypeArgumentKind ta1, |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
169 |
SignatureKind sig2, ReturnTypeKind rt2, TypeArgumentKind ta2, |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
170 |
ReturnTypeKind rt3, TypeArgumentKind ta3) { |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
171 |
this.sig1 = sig1; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
172 |
this.sig2 = sig2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
173 |
this.rt1 = rt1; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
174 |
this.rt2 = rt2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
175 |
this.rt3 = rt3; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
176 |
this.ta1 = ta1; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
177 |
this.ta2 = ta2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
178 |
this.ta3 = ta3; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
179 |
this.source = new JavaSource(); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
180 |
this.diagChecker = new DiagnosticChecker(); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
181 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
182 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
183 |
class JavaSource extends SimpleJavaFileObject { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
184 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
185 |
String template = "import java.util.*;\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
186 |
"interface A { #S1 #R1#TA1 m(); }\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
187 |
"interface B { #S2 #R2#TA2 m(); }\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
188 |
"interface AB extends A, B {}\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
189 |
"class Test {\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
190 |
" void test(AB ab) { #R3#TA3 n = ab.m(); }\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
191 |
"}"; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
192 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
193 |
String source; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
194 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
195 |
public JavaSource() { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
196 |
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
197 |
source = template.replace("#S1", sig1.paramStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
198 |
replace("#S2", sig2.paramStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
199 |
replace("#R1", rt1.retStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
200 |
replace("#R2", rt2.retStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
201 |
replace("#R3", rt3.retStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
202 |
replace("#TA1", ta1.typeargStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
203 |
replace("#TA2", ta2.typeargStr). |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
204 |
replace("#TA3", ta3.typeargStr); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
205 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
206 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
207 |
@Override |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
208 |
public CharSequence getCharContent(boolean ignoreEncodingErrors) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
209 |
return source; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
210 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
211 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
212 |
|
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
213 |
@Override |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
214 |
public void run() { |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
215 |
JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker, |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
216 |
null, null, Arrays.asList(source)); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
217 |
try { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
218 |
ct.analyze(); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
219 |
} catch (Throwable ex) { |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
220 |
throw new AssertionError("Error thrown when compiling the following code:\n" + |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
221 |
source.getCharContent(true)); |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
222 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
223 |
check(); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
224 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
225 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
226 |
void check() { |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
227 |
checkCount.incrementAndGet(); |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
228 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
229 |
boolean errorExpected = false; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
230 |
int mostSpecific = 0; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
231 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
232 |
//first check that either |R1| <: |R2| or |R2| <: |R1| |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
233 |
if (rt1 != rt2) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
234 |
if (!rt1.moreSpecificThan(rt2) && |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
235 |
!rt2.moreSpecificThan(rt1)) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
236 |
errorExpected = true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
237 |
} else { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
238 |
mostSpecific = rt1.moreSpecificThan(rt2) ? 1 : 2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
239 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
240 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
241 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
242 |
//check that either TA1 <= TA2 or TA2 <= TA1 (unless most specific return found above is raw) |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
243 |
if (!errorExpected) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
244 |
if (ta1 != ta2) { |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
245 |
boolean useStrictCheck = ta1.moreSpecificThan(ta2, true) || |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
246 |
ta2.moreSpecificThan(ta1, true); |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
247 |
if (!ta1.moreSpecificThan(ta2, useStrictCheck) && |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
248 |
!ta2.moreSpecificThan(ta1, useStrictCheck)) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
249 |
errorExpected = true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
250 |
} else { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
251 |
int mostSpecific2 = ta1.moreSpecificThan(ta2, useStrictCheck) ? 1 : 2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
252 |
if (mostSpecific != 0 && mostSpecific2 != mostSpecific) { |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
253 |
errorExpected = mostSpecific == 1 ? |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
254 |
ta1 != TypeArgumentKind.NONE : |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
255 |
ta2 != TypeArgumentKind.NONE; |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
256 |
} else { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
257 |
mostSpecific = mostSpecific2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
258 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
259 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
260 |
} else if (mostSpecific == 0) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
261 |
//when no signature is better than the other, an arbitrary choice |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
262 |
//must be made - javac always picks the second signature |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
263 |
mostSpecific = 2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
264 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
265 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
266 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
267 |
//finally, check that most specific return type is compatible with expected type |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
268 |
if (!errorExpected) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
269 |
ReturnTypeKind msrt = mostSpecific == 1 ? rt1 : rt2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
270 |
TypeArgumentKind msta = mostSpecific == 1 ? ta1 : ta2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
271 |
SignatureKind mssig = mostSpecific == 1 ? sig1 : sig2; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
272 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
273 |
if (!msrt.moreSpecificThan(rt3) || |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
274 |
!msta.assignableTo(ta3, mssig)) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
275 |
errorExpected = true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
276 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
277 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
278 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
279 |
if (errorExpected != diagChecker.errorFound) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
280 |
throw new Error("invalid diagnostics for source:\n" + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
281 |
source.getCharContent(true) + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
282 |
"\nFound error: " + diagChecker.errorFound + |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
283 |
"\nExpected error: " + errorExpected); |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
284 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
285 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
286 |
|
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
287 |
static class DiagnosticChecker |
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
288 |
implements javax.tools.DiagnosticListener<JavaFileObject> { |
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
289 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
290 |
boolean errorFound; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
291 |
|
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
292 |
public void report(Diagnostic<? extends JavaFileObject> diagnostic) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
293 |
if (diagnostic.getKind() == Diagnostic.Kind.ERROR) { |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
294 |
errorFound = true; |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
295 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
296 |
} |
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
297 |
} |
15040
99fd9483d3f0
8005167: execution time of combo tests in javac should be improved
vromero
parents:
11381
diff
changeset
|
298 |
|
10197
28afe0fb34c8
7062745: Regression: difference in overload resolution when two methods are maximally specific
mcimadamore
parents:
diff
changeset
|
299 |
} |