On Tue, 25 Mar 2025 08:33:57 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> Please help review this cleanup PR which makes the > `java.net.JarURLConnection` fields `jarFileURL` and `entryName` final. > > The current `parseSpec` method is somewhat crufty, with some code quality > issues which this PR aims to improve: > > * The method-level comment seems stale and misplaced > * The local variable `separator` is confusingly incremented during parsing > (using pre AND post increment operators) > * Unused local variables introduced for the sole purpose of attaching > `@SuppressWarnings` annotations > * The `jarFileURL` and `entryName` fields are both assigned more than once > * Block comments are used where line comments would suffice > > The PR addresses the above issues by inlining `parseSpec` into the > constructor, then extracting static helper methods for parsing the file URL > and the entry name. This allows the fields to be made final. > > Since this is purely a refactoring PR, no tests are updated and the > `noreg-cleanup` label is added in JBS. > > Reviewing individual commits in this PR may aid verification of separate > refactorings. This looks reasonable to me. Please run tier1 and tier2 to make sure nothing fails unexpectedly. src/java.base/share/classes/java/net/JarURLConnection.java line 186: > 184: */ > 185: @SuppressWarnings("deprecation") > 186: private static URL parseJarFileURL(String spec, int separator, URL > connectionURL) throws MalformedURLException { Nit - maybe rename `separator` to `separatorIndex`? Here and in the other private method. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/24218#pullrequestreview-2713017219 PR Review Comment: https://git.openjdk.org/jdk/pull/24218#discussion_r2011679632