Bug 559965 - No recompilation when deleting java file from test-source-folder
Summary: No recompilation when deleting java file from test-source-folder
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.15   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.15 M3   Edit
Assignee: Till Brychcy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-10 04:55 EST by Carsten Pfeiffer CLA
Modified: 2020-03-25 04:39 EDT (History)
5 users (show)

See Also:


Attachments
Example project demonstrating the problem (2.98 KB, application/zip)
2020-02-10 04:55 EST, Carsten Pfeiffer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Pfeiffer CLA 2020-02-10 04:55:26 EST
Created attachment 281763 [details]
Example project demonstrating the problem

Consider a plain java project with a test-source-folder (attribute "test" set to true) and two java files inside the test-source-folder, where one references the other.

project
- testsources
  - A.java
  - B.java

B.java contains a reference to A.java.

Now if you delete A.java, a compilation error should be shown for B.java, but this does not happen (independent of Auto-build/Manual build).

The java editor actually flags the error, but not the package explorer or the problems view.

The compilation error only appears when you manually change B.java or force a clean build.

See attached example project.
Comment 1 Till Brychcy CLA 2020-02-10 13:28:30 EST
Thanks, I can reproduce.
Comment 2 Eclipse Genie CLA 2020-02-12 01:38:56 EST
New Gerrit change created: https://git.eclipse.org/r/157539
Comment 4 Till Brychcy CLA 2020-02-13 02:12:31 EST
(In reply to Eclipse Genie from comment #3)
> Gerrit change https://git.eclipse.org/r/157539 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=a457a5aee500850424330cb51a4d360b58b7a5b7

Released for 4.15 M3
Comment 5 Carsten Pfeiffer CLA 2020-02-13 11:28:56 EST
Awesome, thanks!
Comment 6 Eclipse Genie CLA 2020-02-14 03:02:22 EST
New Gerrit change created: https://git.eclipse.org/r/157694
Comment 8 Till Brychcy CLA 2020-02-14 04:36:05 EST
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/157694 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=1c92dd5f9d58eadd7db8b2a56a4340f281baa322

Thanks.
Shouldn't my gerrit have failed if a version bump is necessary?
I think it used to do that - or am I confusing something...
Comment 9 Alexander Kurtakov CLA 2020-02-14 04:53:04 EST
(In reply to Till Brychcy from comment #8)
> (In reply to Eclipse Genie from comment #7)
> > Gerrit change https://git.eclipse.org/r/157694 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> > ?id=1c92dd5f9d58eadd7db8b2a56a4340f281baa322
> 
> Thanks.
> Shouldn't my gerrit have failed if a version bump is necessary?
> I think it used to do that - or am I confusing something...

Unfortunately not for jdt.core only due to org.eclipse.jdt.annotation which is same bundleId at different versions so comparison with baseline fails. Probably only annotation bundles should be skipped rather than whole repo though.
Comment 10 Till Brychcy CLA 2020-02-14 05:04:06 EST
Thanks for the explanation!
Comment 11 Stephan Herrmann CLA 2020-03-24 15:54:50 EDT
@Till, after Andrey pointed to this bug from bug 561287 comment 16, I had a look at the change here, and must admit, I'm a bit confused: we now have two different paths how a builder can delegate to this.testImageBuilder.addAffectedSourceFiles(Set,Set,Set,Set). One passes the recorded strings from the main builder to the test builder (inside addAffectedSourceFiles() and the other unconditionally invokes addAffectedSourceFiles() (no-arg).

Please verify my attempt to understand this:

In the next round, the main builder must only compile those files detected as affected during it's own invocation, whereas the test builder must compile affected files detected by either builder. Is this it?

But then, is it OK for both builders to compile the same file??
Comment 12 Till Brychcy CLA 2020-03-25 04:39:53 EDT
(In reply to Stephan Herrmann from comment #11)
> In the next round, the main builder must only compile those files detected
> as affected during it's own invocation, whereas the test builder must
> compile affected files detected by either builder. Is this it?
Yes (but the main builder completes its incrementalBuildLoop, before the test builder starts)

> 
> But then, is it OK for both builders to compile the same file??

That should never happen, each builder only compiles files from the source folders it is responsible for (see findSourceFile). But it may happen that compilation of a file is triggered from both builders (but should be done only one time, because the files to be compiled are managed as sets, not lists)