Commit fda0f3dd authored by Eric Bruneton's avatar Eric Bruneton

Add comments.

parent cc1f89f5
Pipeline #2742 passed with stage
in 6 minutes and 55 seconds
......@@ -207,6 +207,10 @@ public class SimpleVerifier extends BasicVerifier {
if (isAssignableFrom(expectedType, type)) {
return true;
} else if (getClass(expectedType).isInterface()) {
// The merge of class or interface types can only yield class types (because it is not
// possible in general to find an unambiguous common super interface, due to multiple
// inheritance). Because of this limitation, we need to relax the subtyping check here
// if 'value' is an interface.
return Object.class.isAssignableFrom(getClass(type));
} else {
return false;
......
......@@ -531,6 +531,14 @@ public class SimpleVerifierTest extends AsmTest implements Opcodes {
}.test();
}
/**
* Checks that the merge of an ArrayList and an SQLException can be returned as an Iterable. The
* merged type is recomputed by SimpleVerifier as Object (because of limitations of the merging
* algorithm, due to multiple interface inheritance), but the subtyping check is relaxed if the
* super type is an interface type.
*
* @throws AnalyzerException
*/
@Test
public void testIsAssignableFromInterface() throws AnalyzerException {
methodNode =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment