Skip to content

Use destination URI when creating resource during copy refactoring - #3588

Open
mx990 wants to merge 2 commits into
eclipse-xtext:mainfrom
mx990:refactoring-copy-uri-fix
Open

Use destination URI when creating resource during copy refactoring#3588
mx990 wants to merge 2 commits into
eclipse-xtext:mainfrom
mx990:refactoring-copy-uri-fix

Conversation

@mx990

@mx990 mx990 commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

When performing a COPY refactoring, the ResourceRelocationContext created the resource with the original URI and then changed the URI of the resource after loading. This left any proxy URIs in the loaded resource still pointing to the original file. When later resolving the proxies, a second resource for the original file was created on demand and any local references were resolved into that resource and not the copy.

This avoids the problem by creating the resource with the destination URI instead, so that any proxies will be created with the correct URI.

Fixes #3587

@github-actions

github-actions Bot commented Jan 26, 2026

Copy link
Copy Markdown

Test Results

  8 059 files  + 5    8 059 suites  +5   3h 37m 36s ⏱️ - 8m 27s
 43 172 tests + 5   42 588 ✅ + 5    584 💤 ±0  0 ❌ ±0 
212 163 runs  +25  209 242 ✅ +25  2 921 💤 ±0  0 ❌ ±0 

Results for commit 730caae. ± Comparison against base commit 3548a57.

♻️ This comment has been updated with latest results.

@cdietrich

Copy link
Copy Markdown
Contributor

Wonder if this can somehow be tested

@LorenzoBettini

Copy link
Copy Markdown
Contributor

@mx990 just for confirmation: are the added tests FAIL without your patch?
Just to be sure tests are effective.

@mx990

mx990 commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

Yes, (most of) the added tests fail without my patch when running them locally against main.

@mx990
mx990 force-pushed the refactoring-copy-uri-fix branch from a69c9c0 to d083cf6 Compare January 27, 2026 15:11
@mx990
mx990 force-pushed the refactoring-copy-uri-fix branch from d083cf6 to f871b91 Compare January 29, 2026 20:02
@mx990
mx990 force-pushed the refactoring-copy-uri-fix branch from f871b91 to 5a9216d Compare March 18, 2026 20:32
@cdietrich

Copy link
Copy Markdown
Contributor

can you also rebase your pr

@mx990

mx990 commented Mar 19, 2026

Copy link
Copy Markdown
Contributor Author

can you also rebase your pr

it is already on top of current main 088392b

mx990 added 2 commits July 31, 2026 17:43
When performing a COPY refactoring, the ResourceRelocationContext
created the resource with the original URI and then changed the URI of
the resource after loading. This left any proxy URIs in the loaded
resource still pointing to the original file. When later resolving the
proxies, a second resource for the original file was created on demand
and any local references were resolved into that resource and not the
copy.

This avoids the problem by creating the resource with the destination
URI instead, so that any proxies will be created with the correct URI.
This adds tests for the copy resource refactoring based on the Java
copy processor.
@mx990
mx990 force-pushed the refactoring-copy-uri-fix branch from 5a9216d to 730caae Compare July 31, 2026 16:11
@mx990

mx990 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

I have now updated the tests to use the new LTK copy infrastructure. This avoids the internal dependencies of the previous implementation, but requires org.eclipse.ltk.core.refactoring version 3.16.0 or greater. How should I proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale proxy URIs after changing resource URI during copy refactoring

3 participants