On Wed, 20 Jul 2022 08:14:39 GMT, Chris Hegarty <che...@openjdk.org> wrote:
>> This commit ensures streams returned by ModuleReader::list are closed. > > test/jdk/java/lang/invoke/callerSensitive/CallerSensitiveAccess.java line 411: > >> 409: try (ModuleReader reader = mref.open(); >> 410: Stream<String> stream = reader.list()) { >> 411: return stream > > This change is causing the test to fail, in the `callerSensitiveMethods` > DataProvider, because the data provider is expecting an open stream to be > returned by `callerSensitiveMethods(Module)` - the stream is now closed. > > There are a couple of ways to resolve this, but the most straightforward > would be to revert this part of the change, and have the > `callerSensitiveMethods` DataProvider close the returned stream. E.g.: > > > @DataProvider(name = "callerSensitiveMethods") > static Object[][] callerSensitiveMethods() { > try (var methodStream = > callerSensitiveMethods(Object.class.getModule())) { > return methodStream > .map(m -> new Object[]{m, shortDescription(m)}) > .toArray(Object[][]::new); > } > } yes, this would solve it. ------------- PR: https://git.openjdk.org/jdk/pull/9557