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 91265 - Cannot make 2 changes in one Task
Summary: Cannot make 2 changes in one Task
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
: 91675 (view as bug list)
Depends on:
Blocks: 90607 91258 91682 92046
  Show dependency tree
 
Reported: 2006-12-19 10:22 UTC by Milan Kuchtiak
Modified: 2007-01-17 10:09 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Modified tutorial test : testAddMethod (28.58 KB, text/plain)
2006-12-19 10:25 UTC, Milan Kuchtiak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Kuchtiak 2006-12-19 10:22:49 UTC
In my particular case I added the class annotation, then I added a method. The
method in final java source is missing :

public void run(WorkingCopy workingCopy) throws java.io.IOException {
    // get the original class
    ClasssTree class1 = ...
    // create annotation and add it to class1
    ClasssTree class2 = ...
    // create method and add it to class2
    ClasssTree class3 = ...
    // rewrite
    workingCopy.rewrite(class1, class3);
}
Comment 1 Milan Kuchtiak 2006-12-19 10:25:03 UTC
Created attachment 36793 [details]
Modified tutorial test : testAddMethod
Comment 2 Pavel Flaska 2006-12-19 10:32:55 UTC
My issue. Thanks for the test.
Comment 3 Andrei Badea 2007-01-02 14:33:46 UTC
*** Issue 91675 has been marked as a duplicate of this issue. ***
Comment 4 Pavel Flaska 2007-01-08 19:08:01 UTC
It is not directly caused by two changes in one modification task - it
definitely works, refactoring in some cases provides correct results.

From my current observation, I see these two causes:
i) when annotation is added, ImmutableTreeTranslator does not copy position from
old class tree to new one. Generator then detects then old class disappeared and
new was added. The new tree is then whole written instead of looking for minimal
changes. Observable when you have some comments inside.

ii) When whole class is printed, syntetic constructor is improperly detected I
think. I do not know details right now, but in my test new default constructor
appeared and method was missing. This is caused by really annoying feature, that
also syntetic things are in the tree, but they do not have mapped elements in
source.

When i) is fixed, this issue should not be reproducible, but also ii) should be
fixed.
Comment 5 Jan Horvath 2007-01-09 10:03:40 UTC
This issue blocks generation of entity classes and because it is important functionality for M6 I marked 
this issue as milestone stopper
Comment 6 Pavel Flaska 2007-01-09 16:57:22 UTC
Checking in org/netbeans/modules/java/source/save/CasualDiff.java;
/cvs/java/source/src/org/netbeans/modules/java/source/save/CasualDiff.java,v 
<--  CasualDiff.java
new revision: 1.30; previous revision: 1.29
done
Comment 7 Pavel Flaska 2007-01-09 17:01:44 UTC
Test

Checking in cfg-unit.xml;
/cvs/java/source/test/cfg-unit.xml,v  <--  cfg-unit.xml
new revision: 1.10; previous revision: 1.9
done
RCS file:
/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/TwoModificationsTest.java,v
done
Checking in unit/src/org/netbeans/api/java/source/gen/TwoModificationsTest.java;
/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/TwoModificationsTest.java,v
 <--  TwoModificationsTest.java
initial revision: 1.1
done
Comment 8 Petr Jiricka 2007-01-10 08:41:12 UTC
Thanks many times. BTW, why don't these tests run on a daily basis? I don't see
them anywhere in the nightly test results.
Comment 9 Pavel Flaska 2007-01-10 16:13:34 UTC
Because nobody put them out. I can consider about publishing some subset of them.