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 100829 - TreeMaker wipes all comments from copied Tree
Summary: TreeMaker wipes all comments from copied Tree
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords: API
Depends on: 144209
Blocks: 90254
  Show dependency tree
 
Reported: 2007-04-12 18:13 UTC by Jan Pokorsky
Modified: 2008-08-21 12:57 UTC (History)
1 user (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 Jan Pokorsky 2007-04-12 18:13:55 UTC
I have method

/**
 * comment
 * @return 1
 */
int method() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    return 1;
}

and I get 

int method() {
    return 1;
}

after TreeMaker.addClassMember
Comment 1 Jan Pokorsky 2007-04-12 18:20:46 UTC
See testCopyMethodWithCommments() in

/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/CommentsTest.java
new revision: 1.12; previous revision: 1.11
Comment 2 Pavel Flaska 2007-09-12 11:52:48 UTC
The tree is printed at new place. If I'll try to preserve all the comments, I have to map them immediately when working
copy is used. This will have huge negative impact to performance. We agreed such copying will be available explicitly,
I'll provide a method for it.
Comment 3 Jan Pokorsky 2007-09-12 12:52:03 UTC
The explicit copy support will be great.
Comment 4 Pavel Flaska 2007-10-12 10:51:44 UTC
Accurately, it does not copy the comments. (no wipe is made, tree is copied from different location to the new one.)
I've experience the similar problem as a I had in #117607. I do not have a token sequence available for source tree
(i.e. the place where tree was originally placed) and this means I cannot do anything. Will try to think about another
hacky stuff, but perhaps will not be able to fix it to 6.0.

Comment 5 Pavel Flaska 2007-10-16 14:47:38 UTC
;-)

Checking in src/org/netbeans/api/java/source/GeneratorUtilities.java;
/cvs/java/source/src/org/netbeans/api/java/source/GeneratorUtilities.java,v  <--  GeneratorUtilities.java
new revision: 1.11; previous revision: 1.10
done
Comment 6 Jan Pokorsky 2007-10-16 15:03:07 UTC
It is close the goal but still not working. I am fine with API but the impl fails.

Test case:

class A {

    /**
     * AAA javadoc
     */
    public static final int AAA = 0;
    
    /**
     * am javadoc
     * @param a a param
     * @return vrat
     * @throws java.io.IOException hod
     */
    public int am(int a) throws IOException {
        // am inner comment
        return 0;
    }
    
    // f comment
    int f;
}

I move all members to a new class and I get

class A extends NewClass {

    /**
     * AAA javadoc
     */
}

and

class NewClass {

    /**
     * AAA javadoc
     */
    public static final int AAA = 0;

    // f comment

    // f comment
    int f;

    public int am(int a) throws IOException {
        // am inner comment
        return 0;
    }

}
Comment 7 Pavel Flaska 2007-10-22 14:31:14 UTC
Test stuff.

/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/CommentsTest.java,v  <--  CommentsTest.java
new revision: 1.24; previous revision: 1.23
done
Comment 8 Pavel Flaska 2007-10-22 15:42:37 UTC
Now the comments aren't duplicated.

Checking in org/netbeans/api/java/source/TranslateIdentifier.java;
/cvs/java/source/src/org/netbeans/api/java/source/TranslateIdentifier.java,v  <--  TranslateIdentifier.java
new revision: 1.2; previous revision: 1.1
done
Comment 9 Pavel Flaska 2007-10-22 16:23:03 UTC
Checking in src/org/netbeans/api/java/source/TranslateIdentifier.java;
/cvs/java/source/src/org/netbeans/api/java/source/TranslateIdentifier.java,v  <--  TranslateIdentifier.java
new revision: 1.3; previous revision: 1.2
done
Checking in test/unit/src/org/netbeans/api/java/source/gen/CommentsTest.java;
/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/CommentsTest.java,v  <--  CommentsTest.java
new revision: 1.25; previous revision: 1.24
done