Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force reconciling if a java project was touched #2079

Closed
wants to merge 1 commit into from

Conversation

laeubi
Copy link
Contributor

@laeubi laeubi commented Mar 12, 2025

What it does

If a classpath container changes, JDT "touches" the project resulting in a resource change being triggered. This is currently ignored by the JavaReconciler leading to possible wrong state displayed in an editor.

This now enhance the JavaReconciler to check for changed java projects if not already a reconciling was forced.

Fix #2074

How to test

see

Author checklist

If a classpath container changes, JDT "touches" the project resulting in
a resource change being triggered. This is currently ignored by the
JavaReconciler leading to possible wrong state displayed in an editor.

This now enhance the JavaReconciler to check for changed java projects
if not already a reconciling was forced.

Fix eclipse-jdt#2074
@Phillipus
Copy link

Hi, I tested this PR using build I20250311-1800 and the simple test case from eclipse-pde/eclipse.pde#1667 (comment).

Unfortunately, I see the same behaviour. The first launch of child Eclipse debug is OK, but thereafter the error markers remain. There are a couple of times the markers clear, but mainly on each launch they remain red.

@laeubi
Copy link
Contributor Author

laeubi commented Mar 12, 2025

It seems sometimes the flags are just zero ... but this is also the case for a normal resource change. So I'm a bit out of ideas how to detect that actually the classpath of the project was modified.

One can for example try it out by adding/removing a JUNIT classpath container. In this case it triggers a resource change with flags=0.

@laeubi
Copy link
Contributor Author

laeubi commented Mar 12, 2025

@Phillipus just curious, can you try to create a second project?

If I look at org.eclipse.jdt.core.JavaCore.setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) it has special handling for if there is only one project updated. and even though the API claims that

In reaction to changing container values, the JavaModel will be updated to reflect the new state of the updated container. A combined Java element delta will be notified to describe the corresponding classpath changes resulting from the container update.

I can't see that this happens it seems it only updates some internal maps...

@laeubi
Copy link
Contributor Author

laeubi commented Mar 12, 2025

Closing as it does not seem the right way.

@laeubi laeubi closed this Mar 12, 2025
@Phillipus
Copy link

@Phillipus just curious, can you try to create a second project?

Yep, that makes a difference. I created a second project just the same as the first and the red markers do not appear, even momentarily.

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.

Java Editor is showing errors due to missing updates from the build sometimes
2 participants