/** *Allambiguousmethoddeclarationsshouldfail.
*/ publicstaticclass A { publicvoid m(X x1, X x2) { thrownew Error("A.m(X,X) should not be called");
}
publicvoid m(X x1, Y y2) { thrownew Error("A.m(X,Y) should not be called");
}
publicvoid m(Y y1, X x2) { thrownew Error("A.m(Y,X) should not be called");
}
}
/** *Themostspecificmethodinthiscasewouldbetheseconddeclaration.
*/ publicstaticclass B { publicvoid m(X x1, X x2) { thrownew Error("B.m(X,X) should not be called");
}
publicvoid m(X x1, Y y2) { // expected: B.m(X,Y) should be called
}
}
/** *Themostspecificmethodinthiscasewouldbethefirstdeclaration.
*/ publicstaticclass C { publicvoid m(Y y1, Y y2) { // expected: C.m(Y,Y) should be called
}
publicvoid m(X x1, X x2) { thrownew Error("C.m(X,X) should not be called");
}
}
/** *Sameasthepreviouscasebutflipmethods.
*/ publicstaticclass D { publicvoid m(X x1, X x2) { thrownew Error("D.m(X,X) should not be called");
}
publicvoid m(Y y1, Y y2) { // expected: D.m(Y,Y) should be called
}
}
/** *Themethodshouldbecalledwith(Z,Z).
*/ publicstaticclass E { publicvoid m(X x1, X x2) { // expected: E.m(X,X) should be called
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.