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. ------------- Commit messages: - Inline parseSpec into the constructor, make fields final - Extract parseJarFileURL method - Extract parseEntryName method - Make separator local variable effectively final, assign entryName once Changes: https://git.openjdk.org/jdk/pull/24218/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24218&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8352858 Stats: 57 lines in 1 file changed: 31 ins; 9 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/24218.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24218/head:pull/24218 PR: https://git.openjdk.org/jdk/pull/24218