From 989ef3ec43cba4ba7eb03a6bbfec70de4628233b Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Fri, 25 May 2018 11:13:31 -0500 Subject: [PATCH] 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. --- .../tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java index 49e87130e..eef8b589e 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java @@ -206,8 +206,9 @@ public class PruneArrayOutOfBoundExceptionEdge { SSAInstruction lastInstruction = block.getLastInstruction(); lastInstruction.getExceptionTypes(); - Matcher> matcher1 = anyOf(hasItem(equalTo(TypeReference.JavaLangNullPointerException)), - hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException))); + final Matcher> isJLNPE = hasItem(equalTo(TypeReference.JavaLangNullPointerException)); + final Matcher> isJLAIOOBE = hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException)); + final Matcher> matcher1 = anyOf(isJLNPE, isJLAIOOBE); collector.checkThat("Edge deleted but cause instruction can't throw NullPointerException" + "nor ArrayIndexOutOfBoundsException: " + identifyer + ":" + method.getLineNumber(lastInstruction.iindex),