René's URL Explorer Experiment


Title: Chunk array constructors retain input arrays and can change existing patches · Issue #242 · java-diff-utils/java-diff-utils · GitHub

Open Graph Title: Chunk array constructors retain input arrays and can change existing patches · Issue #242 · java-diff-utils/java-diff-utils

X Title: Chunk array constructors retain input arrays and can change existing patches · Issue #242 · java-diff-utils/java-diff-utils

Description: Describe the bug The Chunk array constructors say they save a copy of the affected lines, but the three-argument constructor stores Arrays.asList(lines). That list is backed by the caller's array. The two-argument array constructor deleg...

Open Graph Description: Describe the bug The Chunk array constructors say they save a copy of the affected lines, but the three-argument constructor stores Arrays.asList(lines). That list is backed by the caller's array. ...

X Description: Describe the bug The Chunk array constructors say they save a copy of the affected lines, but the three-argument constructor stores Arrays.asList(lines). That list is backed by the caller's arr...

Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/issues/242

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Chunk array constructors retain input arrays and can change existing patches","articleBody":"**Describe the bug**\n\nThe `Chunk` array constructors say they save a copy of the affected lines, but the three-argument constructor stores `Arrays.asList(lines)`. That list is backed by the caller's array. The two-argument array constructor delegates to it, so both retain the input.\n\nChanging the source array after constructing a patch makes the patch fail its source check. Changing only the revised array silently changes what the patch writes. The `List` constructors already make a defensive copy.\n\n**To reproduce**\n\n```java\nString[] revised = {\"new\"};\nPatch\u003cString> patch = new Patch\u003c>();\npatch.addDelta(new ChangeDelta\u003c>(\n    new Chunk\u003c>(0, new String[] {\"old\"}), new Chunk\u003c>(0, revised)));\nrevised[0] = \"changed revision\";\nSystem.out.println(patch.applyTo(Arrays.asList(\"old\")));\n```\n\nActual output: `[changed revision]`.\n\nIf the source array is changed instead, `applyTo` throws `PatchFailedException: CONTENT_DOES_NOT_MATCH_TARGET` even when given the original source text.\n\n**Expected behavior**\n\nThe patch should retain the line values supplied when the chunks were constructed. The example should return `[new]`, consistently with the constructor Javadoc and the `List` overloads.\n\nA one-line defensive copy fixes both array overloads. Three regression tests cover source-array mutation, the overload with change positions, and revised-array mutation. On unchanged source the tests produce two patch-application errors and one wrong-output assertion; all pass with the copy.\n\n**System**\n\n- Linux, Temurin 17.0.21.\n- Current master `07a374624840a238e0c4e97dc94a30e0ac92ce28`, version `4.19-SNAPSHOT`.\n- Full `mvn -B -ntp package` passes across both modules: 173 tests, zero failures/errors, 3 existing skips, zero Checkstyle violations, and Javadocs built.","author":{"url":"https://github.com/parijat1222q","@type":"Person","name":"parijat1222q"},"datePublished":"2026-11-10T12:50:38Z","url":"https://github.com/java-diff-utils/java-diff-utils/issues/242"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e721bccf-1ca4-8427-8983-3960d29cfbd1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA514:14700E:34AC46F:42E851E:6B01DDC8
html-safe-noncec405b6b140f252a88d354a83d3565d9df4e4e0771268beca3ef4d47e0a6941a0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTE0OjE0NzAwRTozNEFDNDZGOjQyRTg1MUU6NkIwMUREQzgiLCJ2aXNpdG9yX2lkIjoiNTE3NTY3ODI3MjAxMjQxMDMxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4aa0cf73cc36c9a2368be93178d14a18cd49140fd44f365a46dbf71db9d042b7
hovercard-subject-tagissue:6307164049
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/java-diff-utils/java-diff-utils/242/issue_layout
twitter:imagehttps://opengraph.githubassets.com/35db16d4366283e63d4b71a80d4184f63c658552ab6655bb3ac6ad675a830082/java-diff-utils/java-diff-utils/issues/242
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/35db16d4366283e63d4b71a80d4184f63c658552ab6655bb3ac6ad675a830082/java-diff-utils/java-diff-utils/issues/242
og:image:altDescribe the bug The Chunk array constructors say they save a copy of the affected lines, but the three-argument constructor stores Arrays.asList(lines). That list is backed by the caller's array. ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameparijat1222q
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/java-diff-utils/java-diff-utils git https://github.com/java-diff-utils/java-diff-utils.git
octolytics-dimension-user_id40540835
octolytics-dimension-user_loginjava-diff-utils
octolytics-dimension-repository_id86663812
octolytics-dimension-repository_nwojava-diff-utils/java-diff-utils
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id86663812
octolytics-dimension-repository_network_root_nwojava-diff-utils/java-diff-utils
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/java-diff-utils/java-diff-utils/issues/242#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjava-diff-utils%2Fjava-diff-utils%2Fissues%2F242
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjava-diff-utils%2Fjava-diff-utils%2Fissues%2F242
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=java-diff-utils%2Fjava-diff-utils
Reloadhttps://github.com/java-diff-utils/java-diff-utils/issues/242
Reloadhttps://github.com/java-diff-utils/java-diff-utils/issues/242
Reloadhttps://github.com/java-diff-utils/java-diff-utils/issues/242
java-diff-utilshttps://github.com/java-diff-utils
java-diff-utilshttps://github.com/java-diff-utils/java-diff-utils
Codehttps://github.com/java-diff-utils/java-diff-utils
Issues2 (2)https://github.com/java-diff-utils/java-diff-utils/issues
Pull requests2 (2)https://github.com/java-diff-utils/java-diff-utils/pulls
Discussionshttps://github.com/java-diff-utils/java-diff-utils/discussions
Actionshttps://github.com/java-diff-utils/java-diff-utils/actions
Projectshttps://github.com/java-diff-utils/java-diff-utils/projects
Wikihttps://github.com/java-diff-utils/java-diff-utils/wiki
Security and qualityhttps://github.com/java-diff-utils/java-diff-utils/security
Insightshttps://github.com/java-diff-utils/java-diff-utils/insights
https://github.com/java-diff-utils/java-diff-utils
New issuehttps://github.com/login?return_to=https://github.com/java-diff-utils/java-diff-utils/issues/242
New issuehttps://github.com/login?return_to=https://github.com/java-diff-utils/java-diff-utils/issues/242
#243https://github.com/java-diff-utils/java-diff-utils/pull/243
Chunk array constructors retain input arrays and can change existing patcheshttps://github.com/java-diff-utils/java-diff-utils/issues/242#top
#243https://github.com/java-diff-utils/java-diff-utils/pull/243
https://github.com/parijat1222q
parijat1222qhttps://github.com/parijat1222q
on Nov 10, 2026https://github.com/java-diff-utils/java-diff-utils/issues/242#issue-6307164049
Sign up for freehttps://github.com/signup?return_to=https://github.com/java-diff-utils/java-diff-utils/issues/242
Sign in to commenthttps://github.com/login?return_to=https://github.com/java-diff-utils/java-diff-utils/issues/242
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.