langtools/test/tools/javac/TryWithResources/TwrTests.java
Print this page
@@ -88,11 +88,11 @@
Resource r1 = createResource(1, createFailureId, bitMap, closedList)) {
throw new AssertionError("Entire resource creation succeeded");
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed");
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -110,11 +110,11 @@
throw new AssertionError("Entire resource creation succeeded");
}
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed");
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -132,11 +132,11 @@
Resource r2 = createResource(2, createFailureId, bitMap, closedList)) {
throw new AssertionError("Entire resource creation succeeded");
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -156,11 +156,11 @@
}
}
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -179,11 +179,11 @@
Resource r3 = createResource(3, createFailureId, bitMap, closedList)) {
throw new AssertionError("Entire resource creation succeeded");
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -205,11 +205,11 @@
}
}
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -229,11 +229,11 @@
Resource r4 = createResource(4, createFailureId, bitMap, closedList)) {
throw new AssertionError("Entire resource creation succeeded");
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -257,11 +257,11 @@
}
}
} catch (Resource.CreateFailException e) {
creationFailuresDetected++;
checkCreateFailureId(e.resourceId(), createFailureId);
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
throw new AssertionError("Secondary exception suppression failed:" + e);
}
checkForSingleCreationFailure(creationFailuresDetected);
checkClosedList(closedList, createFailureId);
@@ -308,11 +308,11 @@
/**
* Check for proper suppressed exceptions in proper order.
*
* @param suppressedExceptions the suppressed exceptions array returned by
- * getSuppressedExceptions()
+ * getSuppressed()
* @bitmap a bitmap indicating which suppressed exceptions are expected.
* Bit i is set iff id should throw a CloseFailException.
*/
private static void checkSuppressedExceptions(Throwable[] suppressedExceptions, int bitMap) {
if (suppressedExceptions.length != Integer.bitCount(bitMap))
@@ -374,11 +374,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -386,11 +386,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 1);
}
}
}
@@ -407,11 +407,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -419,11 +419,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 2);
}
}
}
@@ -441,11 +441,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -453,11 +453,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 2);
}
}
}
@@ -475,11 +475,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -487,11 +487,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 3);
}
}
}
@@ -511,11 +511,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -523,11 +523,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 3);
}
}
}
@@ -546,11 +546,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -558,11 +558,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 4);
}
}
}
@@ -584,11 +584,11 @@
throw new AssertionError(
"Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -596,11 +596,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 4);
}
}
}
@@ -619,11 +619,11 @@
} catch (Resource.CreateFailException e) {
throw new AssertionError("Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -631,11 +631,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 5);
}
}
}
@@ -658,11 +658,11 @@
} catch (Resource.CreateFailException e) {
throw new AssertionError("Resource creation failed: " + e.resourceId());
} catch (MyKindOfException e) {
if (failure == 0)
throw new AssertionError("Unexpected MyKindOfException");
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap);
} catch (Resource.CloseFailException e) {
if (failure == 1)
throw new AssertionError("Secondary exception suppression failed");
int id = e.resourceId();
if (bitMap == 0)
@@ -670,11 +670,11 @@
int highestCloseFailBit = Integer.highestOneBit(bitMap);
if (1 << id != highestCloseFailBit) {
throw new AssertionError("CloseFailException: got id " + id
+ ", expected lg(" + highestCloseFailBit +")");
}
- checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+ checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
}
checkClosedList(closedList, 5);
}
}
}