fix: override JLSFile.childInfos() to include redirected metadata files#3844
Merged
datho7561 merged 2 commits intoJul 9, 2026
Merged
Conversation
When java.import.generatesMetadataFilesAtProjectRoot is false, JLSFile redirects project metadata files (.project, .classpath, .settings, .factorypath) into the workspace metadata area by overriding childNames(), getChild() and getFileStore(). eclipse-platform PR eclipse-jdtls#2787 added a LocalFile.childInfos() override that performs a bulk native directory listing of the physical location, bypassing childNames()/getChild(). As a result the redirected metadata files became invisible to resource refresh/synchronization, causing MavenProjectMetadataFileTest.testMetadataFileSync and testDeleteClasspath to fail on Eclipse I-builds from I20260630-2300 onward. Override childInfos() to mirror childNames(): start from the fast native super.childInfos() result and append IFileInfo entries for any redirected metadata files that exist in the metadata area. This preserves the eclipse-jdtls#2787 performance improvement (a new list is only allocated when a redirected file must be appended) and does not affect behavior when metadata files are kept at the project root. Fixes eclipse-jdtls#3841 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Changyong Gong <chagon@microsoft.com>
…oviderManagerTest, unrelated to this change) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Changyong Gong <chagon@microsoft.com>
datho7561
approved these changes
Jul 9, 2026
datho7561
left a comment
Contributor
There was a problem hiding this comment.
Looks good, makes sense, and fixes the tests. Thanks, Changyong!
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.
Summary
Fixes the flaky
MavenProjectMetadataFileTestfailures tracked in #3841 (testMetadataFileSyncandtestDeleteClasspath), which began appearing on Eclipse SDK I-builds fromI20260630-2300onward and have been failing PR CI across the repo.Root cause
When
java.import.generatesMetadataFilesAtProjectRootisfalse,JLSFile(ourLocalFilesubclass) redirects the project metadata files (.project,.classpath,.settings,.factorypath) into the workspace metadata area. It does this by overridingchildNames(),getChild()andgetFileStore().eclipse-platform PR #2787 (first shipped in I-build
I20260630-2300) added a newLocalFile.childInfos(int, IProgressMonitor)override that performs a bulk native directory listing of the physical location. That path bypasses bothchildNames()andgetChild(), so the redirected metadata files became invisible toorg.eclipse.core.resourcesrefresh/synchronization (which useschildInfos()for efficiency). The result:IFile.exists()returnsfalseandgetContents()throws for the redirected.classpath, causing the two test failures.Fix
Override
childInfos()inJLSFile, mirroring the existingchildNames()logic:super.childInfos()result (preserving the Bump org.eclipse.tycho.extras:tycho-sourceref-jgit from 4.0.0 to 4.0.1 #2787 performance improvement).IFileInfoentries for any redirected metadata files that exist in the metadata area but are not already present.super.childInfos()unchanged.generatesMetadataFilesAtProjectRoot(),isExcluded(),getProjectNameIfLocationIsProjectRoot()) matchchildNames()exactly, so there is no behavior change when metadata files are kept at the project root.This is fixed entirely on the jdt.ls side — no target-platform pinning and no dependency on an upstream change.
Testing
On the current (regressed) rolling I-build target platform, all filesystem tests pass:
MavenProjectMetadataFileTest— 12/12EclipseProjectMetadataFileTest— 6/6GradleProjectMetadataFileTest— 8/8InvisibleProjectMetadataFileTest— 8/8JLSFsUtilsTest— 4/4Total: 38 tests, 0 failures, 0 errors. Before this change, the same setup produced 1 failure + 1 error in
MavenProjectMetadataFileTest.Fixes #3841