Replace deprecated new URL() with URI-based parsing in Absolute.uri(String)#54
Draft
Replace deprecated new URL() with URI-based parsing in Absolute.uri(String)#54
new URL() with URI-based parsing in Absolute.uri(String)#54Conversation
….uri(String) - Use new URI(preprocessed) instead of new URL(preprocessed) for parsing - Use URI.toURL() for scheme validation (maintains fallback for unknown protocols) - Use URI.getPath() (decoded) instead of URLDecoder.decode(url.getPath()) - Pre-encode [, ], ^ chars that URI is strict about - Remove unused imports: java.net.URL, URLDecoder, StandardCharsets Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
|
Copilot
AI
changed the title
[WIP] Refactor Absolute.uri method to remove deprecated URL constructor
Replace deprecated Feb 20, 2026
new URL() constructor with URI-based parsing in Absolute.uri(String)
Copilot
AI
changed the title
Replace deprecated
Replace deprecated Feb 20, 2026
new URL() constructor with URI-based parsing in Absolute.uri(String)new URL() with URI-based parsing in Absolute.uri(String)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



new URL(String)is deprecated since Java 20. It was used solely as a lenient parser to decompose URI strings into components for re-encoding.Changes
new URL(preprocessed)→new URI(preprocessed)for component extractionURI.getPath()(already decoded) instead ofURLDecoder.decode(url.getPath())getProtocol()→getScheme(),getRef()→getFragment()[,],^before parsing —URIis stricter thanURLabout these in pathsparsedUri.toURL()as a scheme validator — unknown schemes (gitlens, git, untitled) throwMalformedURLException, preserving the existing fallback touri(URI)URL,URLDecoder,StandardCharsetsCharacter-by-character comparison of
toString(),getPath(), and all URI components across all 12 string-input test cases confirms identical output between old and new implementations.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.