Skip to content

fix: override JLSFile.childInfos() to include redirected metadata files#3844

Merged
datho7561 merged 2 commits into
eclipse-jdtls:mainfrom
chagong:fix/jls-childinfos-redirect
Jul 9, 2026
Merged

fix: override JLSFile.childInfos() to include redirected metadata files#3844
datho7561 merged 2 commits into
eclipse-jdtls:mainfrom
chagong:fix/jls-childinfos-redirect

Conversation

@chagong

@chagong chagong commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the flaky MavenProjectMetadataFileTest failures tracked in #3841 (testMetadataFileSync and testDeleteClasspath), which began appearing on Eclipse SDK I-builds from I20260630-2300 onward and have been failing PR CI across the repo.

Root cause

When java.import.generatesMetadataFilesAtProjectRoot is false, JLSFile (our LocalFile subclass) redirects the project metadata files (.project, .classpath, .settings, .factorypath) into the workspace metadata area. It does this by overriding childNames(), getChild() and getFileStore().

eclipse-platform PR #2787 (first shipped in I-build I20260630-2300) added a new LocalFile.childInfos(int, IProgressMonitor) override that performs a bulk native directory listing of the physical location. That path bypasses both childNames() and getChild(), so the redirected metadata files became invisible to org.eclipse.core.resources refresh/synchronization (which uses childInfos() for efficiency). The result: IFile.exists() returns false and getContents() throws for the redirected .classpath, causing the two test failures.

Fix

Override childInfos() in JLSFile, mirroring the existing childNames() logic:

  • Start from the fast native super.childInfos() result (preserving the Bump org.eclipse.tycho.extras:tycho-sourceref-jgit from 4.0.0 to 4.0.1 #2787 performance improvement).
  • Append IFileInfo entries for any redirected metadata files that exist in the metadata area but are not already present.
  • A new array is only allocated when a redirected file actually needs to be appended; the common case returns super.childInfos() unchanged.
  • Early guards (generatesMetadataFilesAtProjectRoot(), isExcluded(), getProjectNameIfLocationIsProjectRoot()) match childNames() 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/12
  • EclipseProjectMetadataFileTest — 6/6
  • GradleProjectMetadataFileTest — 8/8
  • InvisibleProjectMetadataFileTest — 8/8
  • JLSFsUtilsTest — 4/4

Total: 38 tests, 0 failures, 0 errors. Before this change, the same setup produced 1 failure + 1 error in MavenProjectMetadataFileTest.

Fixes #3841

chagong and others added 2 commits July 9, 2026 10:32
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 datho7561 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, makes sense, and fixes the tests. Thanks, Changyong!

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

Projects

None yet

2 participants