On Fri, 29 Nov 2024 13:33:37 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> Please review this PR which applies various cleanups to > `sun.net.www.protocol.file.FileURLConnection`. > > This class is known to be an _old, intricate, and hard to maintain piece of > code._ However, there are some relatively straightforward refactorings / > cleanups possible which improve readability and makes it easier to reason > about what's going on in this class. > > In this PR, I have chosen to make each individual small change a separate > commit. This to assist review of each individual change, which can otherwise > disappear a bit when reviewing the PR as a whole. > > A detailed listing of each commit follows in a separate comment. > > This is a pure cleanup PR, no tests are added or updated in this PR. This PR consists of the following commits: * 46ed3d1 removes the `filename` instance field and replaces its uses with `file.getPath()` * 280e82d makes the `file` field final * b19b893 renames the `files` field to `directoryListing` to better express what the field contains * 6d9cf02 removes the `contentType` instance field, this can be a local variable in `initializeHeaders()` * 9ab8de1 removes an unnecessary catch/rethrow of `IOException` * 95ce976 reorders the instance fields to make the grouping more logical * 633b18b makes instance fields private * eccf281 removes three unused local variables in `getInputStream` * [d990e83](https://github.com/openjdk/jdk/pull/22459/commits/d990e83083f99fee4e20fd602da45cf1da92ac8e) updates the copyright year * [06b2a23](https://github.com/openjdk/jdk/pull/22459/commits/06b2a235fa7cd76d634f01ce0422a38676310d45) removes an explicit type parameter when calling `Arrays::asList` * [9efa3b](https://github.com/openjdk/jdk/pull/22459/commits/f9efa3b86086b27db2c84b4df0c3da50b8ef6d30) uses enhanced for loop when constructing directory listing ------------- PR Comment: https://git.openjdk.org/jdk/pull/22459#issuecomment-2507846633