This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206134 - [regression] Use of FindUsages modifies all documents with references
Summary: [regression] Use of FindUsages modifies all documents with references
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P1 normal (vote)
Assignee: Jan Becicka
URL:
Keywords:
: 208279 (view as bug list)
Depends on: 206907
Blocks:
  Show dependency tree
 
Reported: 2011-12-08 12:27 UTC by Vladimir Voskresensky
Modified: 2012-02-29 14:22 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2011-12-08 12:27:15 UTC
Try to use FindUsages and you will see SaveAll blinking all the time.
More over DataObject.getRegistry() is sending miriad of notification about modified/unmodified objects.

Any client which uses doc.runAtomic*(Runnable r) (where doc is BaseDocument derived class) sends notifications about document modification/unmodification.
This is due to current impl of atomicLockImpl/atomicUnlockImpl after http://hg.netbeans.org/cnd-main/rev/11f80032f91d

In fact when Runnable does only read access may be it is prohibited to use runAtomic, so current impl is correct? => 
- update runAtomic documentation and ask to prevent read-only access
- reassign to refactoring which implements UndoManager.watch using runAtomic (readLock()/readUnlock() should be enough?)
Comment 1 Vladimir Voskresensky 2011-12-12 13:22:18 UTC
I'm blocked by the issue, so had to put workaround.
http://hg.netbeans.org/cnd-main/rev/f58ba02311e1

I think right approach should be:
- do not send modification events in atomicLockImpl/atomicUnlockImpl, but send notification with different name to prevent DataObject registry to react on it.
- react on it in redo/undo system where previously it reacted on modification event.

Btw, use readLock()/readUnlock() is anyway better when only read is don from runnable, but refactoring should be updated as well by removing very expensive FileOwnerQuery from document's lock
Comment 2 Quality Engineering 2011-12-13 10:34:59 UTC
Integrated into 'main-golden', will be available in build *201112130600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/f58ba02311e1
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: workaround for #206134 - [regression] Use of FindUsages modifies all documents with references
Comment 3 Vladimir Voskresensky 2011-12-15 06:51:09 UTC
We need a fix (at least workaround) on UC... Reparse activity on each Find Usages action is unacceptable, especially for big projects.
Comment 4 Miloslav Metelka 2011-12-22 23:02:04 UTC
I'm not familiar much with the refactoring.api code so reassigning to Honza B.
Regarding current workaround: better than AbstractDocument.readLock()/readUnlock() would be Document.render().
Comment 5 Vladimir Voskresensky 2011-12-29 15:54:10 UTC
Mila's workaround is pushed into release71 branch
http://hg.netbeans.org/releases/rev/8c5d9956ee7d
and release71_fixes
http://hg.netbeans.org/releases/rev/d73a2d37b04a
Comment 6 Vladimir Voskresensky 2011-12-29 16:01:40 UTC
spec versions update:
http://hg.netbeans.org/releases/rev/08902b0a5126
http://hg.netbeans.org/releases/rev/6ad31716f83e
Comment 7 Jan Becicka 2012-01-02 07:09:20 UTC
I don't understand what I'm required to do. Find Usages does not perform Save All.
Comment 8 Vladimir Voskresensky 2012-01-10 14:44:48 UTC
Jan, you can leave all as is now in trunk - problem is fixed when instead of write access document is accessed with read only access.
But you can still improve workaround and extract i.e. FileOwnerQuery from document's lock
Comment 9 Vladimir Voskresensky 2012-01-10 15:02:52 UTC
btw issue #206907 is the one which is about introduced regression
Comment 10 Quality Engineering 2012-01-17 16:11:13 UTC
Integrated into 'main-golden', will be available in build *201201170601* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5e983b70b0f7
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: better workaround from Mila (#206134 - [regression] Use of FindUsages modifies all documents with references)
Comment 11 Vladimir Voskresensky 2012-02-13 12:00:40 UTC
*** Bug 208279 has been marked as a duplicate of this bug. ***
Comment 12 Jiri Prox 2012-02-29 14:22:54 UTC
verified