234 } |
234 } |
235 |
235 |
236 void check() { |
236 void check() { |
237 checkCount.incrementAndGet(); |
237 checkCount.incrementAndGet(); |
238 |
238 |
|
239 if (ak1 != ak2) |
|
240 return; |
|
241 |
239 if (!lrk.compatibleWith(rt1) || !lrk.compatibleWith(rt2)) |
242 if (!lrk.compatibleWith(rt1) || !lrk.compatibleWith(rt2)) |
240 return; |
243 return; |
241 |
244 |
242 if (lrk.needsConversion(rt1) != lrk.needsConversion(rt2)) |
245 if (lrk.needsConversion(rt1) != lrk.needsConversion(rt2)) |
243 return; |
246 return; |
244 |
247 |
245 boolean m1MoreSpecific = moreSpecific(rt1, rt2, ek1, ek2, ak1, ak2); |
248 boolean m1MoreSpecific = rt1.moreSpecificThan(rt2); |
246 boolean m2MoreSpecific = moreSpecific(rt2, rt1, ek2, ek1, ak2, ak1); |
249 boolean m2MoreSpecific = rt2.moreSpecificThan(rt1); |
247 |
250 |
248 boolean ambiguous = (m1MoreSpecific == m2MoreSpecific); |
251 boolean ambiguous = (m1MoreSpecific == m2MoreSpecific); |
249 |
252 |
250 if (ambiguous != diagChecker.ambiguityFound) { |
253 if (ambiguous != diagChecker.ambiguityFound) { |
251 throw new Error("invalid diagnostics for source:\n" + |
254 throw new Error("invalid diagnostics for source:\n" + |
264 "\nMost specific found: " + diagChecker.mostSpecificSig + |
267 "\nMost specific found: " + diagChecker.mostSpecificSig + |
265 "\nm1 more specific: " + m1MoreSpecific + |
268 "\nm1 more specific: " + m1MoreSpecific + |
266 "\nm2 more specific: " + m2MoreSpecific); |
269 "\nm2 more specific: " + m2MoreSpecific); |
267 } |
270 } |
268 } |
271 } |
269 } |
|
270 |
|
271 boolean moreSpecific(RetTypeKind rk1, RetTypeKind rk2, ExceptionKind ek1, |
|
272 ExceptionKind ek2, ArgTypeKind ak1, ArgTypeKind ak2) { |
|
273 if (!rk1.moreSpecificThan(rk2)) |
|
274 return false; |
|
275 |
|
276 if (ak1 != ak2) |
|
277 return false; |
|
278 |
|
279 return true; |
|
280 } |
272 } |
281 |
273 |
282 static class DiagnosticChecker |
274 static class DiagnosticChecker |
283 implements javax.tools.DiagnosticListener<JavaFileObject> { |
275 implements javax.tools.DiagnosticListener<JavaFileObject> { |
284 |
276 |