Help Java 9 with some tricky generics type inference
The existing code worked fine under Java 8, but Java 9 fails to resolve type constraints unless it has more explicit information about at least one of the arguments to anyOf. Weird.
This commit is contained in:
parent
d2852beebf
commit
989ef3ec43
|
@ -206,8 +206,9 @@ public class PruneArrayOutOfBoundExceptionEdge {
|
||||||
SSAInstruction lastInstruction = block.getLastInstruction();
|
SSAInstruction lastInstruction = block.getLastInstruction();
|
||||||
lastInstruction.getExceptionTypes();
|
lastInstruction.getExceptionTypes();
|
||||||
|
|
||||||
Matcher<Iterable<? super TypeReference>> matcher1 = anyOf(hasItem(equalTo(TypeReference.JavaLangNullPointerException)),
|
final Matcher<Iterable<? super TypeReference>> isJLNPE = hasItem(equalTo(TypeReference.JavaLangNullPointerException));
|
||||||
hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException)));
|
final Matcher<Iterable<? super TypeReference>> isJLAIOOBE = hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException));
|
||||||
|
final Matcher<Iterable<? super TypeReference>> matcher1 = anyOf(isJLNPE, isJLAIOOBE);
|
||||||
|
|
||||||
collector.checkThat("Edge deleted but cause instruction can't throw NullPointerException"
|
collector.checkThat("Edge deleted but cause instruction can't throw NullPointerException"
|
||||||
+ "nor ArrayIndexOutOfBoundsException: " + identifyer + ":" + method.getLineNumber(lastInstruction.iindex),
|
+ "nor ArrayIndexOutOfBoundsException: " + identifyer + ":" + method.getLineNumber(lastInstruction.iindex),
|
||||||
|
|
Loading…
Reference in New Issue