Bug 172028 - [clean up] Sort members clean up leaks working copies
Summary: [clean up] Sort members clean up leaks working copies
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-29 12:21 EST by Markus Keller CLA
Modified: 2007-02-06 09:11 EST (History)
2 users (show)

See Also:


Attachments
proposed fix (4.55 KB, patch)
2007-01-31 09:53 EST, Benno Baumgartner CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-01-29 12:21:47 EST
HEAD, from fix for bug 168954

Sort members clean up leaks working copies. I found this since I had failing PullUp etc. tests when running our mega-suite AllJDTTests.

The leaked CUs are created by CleanUpPerfTest and CleanUpTest.testSortMembers0*().

The bug is probably in SortMembersFix.createCleanUp(..), which does
		cu.becomeWorkingCopy(null, null);

... but does not call cu.discardWorkingCopy() (put this into a finally block to make sure the counters are always OK)
Comment 1 Markus Keller CLA 2007-01-29 14:37:47 EST
I released a workaround to SortMembersFix (fixes the test failures). Benno, please verify. 

Another question is why CompilationUnitSorter.sort(..) needs a working copy at all. Maybe a better solution would be to relax this precondition in JDT/Core.
Comment 2 Benno Baumgartner CLA 2007-01-30 04:08:26 EST
Sorry Markus, I've should have looked at this closer. 

Alex, you should have asked me what becomeWorkingCopy means, or at least RTFJavadoc: "{@link #discardWorkingCopy} must be call as many times as {@link #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)}."
Now we have to request a change in core again, I guess.
Comment 3 Benno Baumgartner CLA 2007-01-31 09:53:01 EST
Created attachment 57912 [details]
proposed fix

This is a fup of bug 171066. Would it be possible to weaken the working copy precondition as proposed in this patch?
Comment 4 Olivier Thomann CLA 2007-01-31 15:19:38 EST
Released for 3.3M5.
Verifier, please check the javadoc of the new API defined in bug 171066.
Comment 5 Alex Blewitt CLA 2007-01-31 18:08:06 EST
Is the requirement for working copies not required when running Sort Members outside of CleanUp? The current SortMembersOperation opens a new editor with those changes in. Just a thought ...

Alex.
Comment 6 Benno Baumgartner CLA 2007-02-01 04:59:40 EST
Thanks Olivier!

(In reply to comment #5)
> Is the requirement for working copies not required when running Sort Members
> outside of CleanUp? The current SortMembersOperation opens a new editor with
> those changes in. Just a thought ...
> 
> Alex.
> 

Sort members action does not use the new API and the old one has not changed...
Comment 7 Eric Jodet CLA 2007-02-06 07:19:55 EST
Verified for 3.3 M5 using build I20070205-0009