Bug 47079 - [Builder] suspicious side-effects during incremental compile
Summary: [Builder] suspicious side-effects during incremental compile
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-20 09:02 EST by Philipe Mulet CLA
Modified: 2003-11-24 12:17 EST (History)
0 users

See Also:


Attachments
Builder trace (53.35 KB, text/plain)
2003-11-20 09:03 EST, Philipe Mulet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2003-11-20 09:02:54 EST
Build 20031119

In a self-hosted workspace, I checked out a couple changes from CVS, and 
triggered an incremental workspace build (autobuild off). Dependents got 
recompiled as expected, but based on the nature of the changes I did not 
expected any of the .class files in dependent projects to be written out.
Comment 1 Philipe Mulet CLA 2003-11-20 09:03:34 EST
Created attachment 6882 [details]
Builder trace
Comment 2 Philipe Mulet CLA 2003-11-20 09:43:24 EST
Forgot to mention that my workspace had been fully builds a few minutes before.

Example of surprising .class file rewritten in org.eclipse.jdt.ui:
   Writing changed class file SurroundWithTryCatchRefactoring.class
Comment 3 Kent Johnson CLA 2003-11-20 14:30:16 EST
I copied my workspace before sync'ing up & taking the changes to ITypeBinding & 
TypeBinding (in which a new method was added).

In the copied workspace I did a full build before adding these 2 changes. I got 
28 .class files in jdt.ui which have different debug attributes (line #'s).

I put 10 of the 'changed' .class files from the full build & then the 
incremental build in a directory for Olivier to look at.
Comment 4 Olivier Thomann CLA 2003-11-20 14:34:11 EST
The only diffence is in the debug attribute (line number table attribute). It 
looks like one of the two builds is not using the right line ends table. They 
should be identical if the source is the same.
Comment 5 Olivier Thomann CLA 2003-11-20 14:39:24 EST
The full build version is not using the right line end table. The line numbers 
are completely messed up. The incremental build is fine.
Comment 6 Kent Johnson CLA 2003-11-20 17:09:10 EST
Full builds of my workspace using M4 do NOT produce these bogus .class files.

This is a regression from M4.
Comment 7 Philipe Mulet CLA 2003-11-20 18:45:16 EST
Suspicion goes against #getMethodBodies(...) which is updating incorrectly the 
lineEnds table, though it shouldn't.

Wondering if it is not simply forgetting to reset the compilationUnit slot 
properly using the arg one (and would incorrectly point at the last dietParsed 
one).
Comment 8 Olivier Thomann CLA 2003-11-20 20:18:21 EST
The problem comes from a side effect in setLineEnds(...). The call in
getMethodBodies(...) was sharing the same memory between the lineEnds of the
scanner and the compilation result line separator positions.
Because another diet parse occured, it corrupted the compilation result line
separator positions that are then used to generate the line number attributes.
And we end up with invalid debug attributes. So it would be impossible to step
properly through the code.
Fixed by removing setLineEnds and inlining it where we used it. This is done to
prevent other wrong usage of setLineEnds.
Comment 9 Olivier Thomann CLA 2003-11-20 21:46:52 EST
Fixed and released in HEAD.
Comment 10 Philipe Mulet CLA 2003-11-21 05:08:31 EST
Indeed a subsequent diet parse can occur upon request during name resolution of 
method bodies; and before we generate the original code for the initial unit. 
Thus altering its lineEnds table due to the sharing issue.

This problem was introduced for Javadoc diagnosis in local types (since M4) and 
doesn't affect 2.1 stream.
Comment 11 David Audel CLA 2003-11-24 12:17:02 EST
Verified.