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 144209

Summary: [Inner To Outer] Inner class comments lost
Product: java Reporter: err <err>
Component: SourceAssignee: Jan Pokorsky <jpokorsky>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 103623    
Bug Blocks: 100829    

Description err 2008-08-17 20:05:49 UTC
In the following, all the inner class comments are lost in refactoring
    - javadoc comments
    - /* ... */ comments
    - // comments
This is particularly onerous since some comments were added so that the refactoring could proceed, see Issue 144208 .

package javaapplication1;

import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import javax.swing.AbstractAction;

public class Outer {

    static void refresh() {
    }

    /**
     * javadoc comment for Inner.
     */
    static class Inner {
        void refresh() {
            //Outer.refresh();
        }

        /**
         * javadoc for Inner.handler
         * @param e
         */
        void handler(MouseEvent e) {
            new InnerInner();
        }

        private void someInnerMethod() {
            // test comment
            System.err.println("in inner method");
        }

        /**
         * javadoc comment for InnerInner
         */
        private class InnerInner extends AbstractAction {

            /* coment with '*' */

            @Override
            public void actionPerformed(ActionEvent e) {
                someInnerMethod();
            }

        }
    }

}



Product Version: NetBeans IDE 6.5 Beta (Build 200808111757)
Java: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\erra\.netbeans\6.5beta
Comment 1 Jiri Prox 2008-08-19 12:59:23 UTC
This is serious bug -> P2
Comment 2 Jan Pokorsky 2008-08-19 15:40:05 UTC
I will take a look what's wrong.
Comment 3 Jan Pokorsky 2008-08-21 12:57:19 UTC
The refactoring uses GeneratorUtilities.importComments() (issue 100829) that seems to work properly. In debugger, I
found that Trees that are copied to a new compilation unit has another identity thus the comment mapping fails in
VeryPretty. I am trying to fix this in java/source module. Reassigning to java.

BTW it seems to never work even in NB 6.1.
Comment 4 Jan Pokorsky 2008-08-21 18:22:27 UTC
fixed as http://hg.netbeans.org/main/rev/a134ca8457bd

The issue of lost standalone comments (e.g. //Outer.refresh();) still remains. It is tracked as issue 103623.
Comment 5 Quality Engineering 2008-08-22 06:01:30 UTC
Integrated into 'main-golden', available in build *200808220201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/a134ca8457bd
User: Jan Pokorsky <jpokorsky@netbeans.org>
Log: #144209: fixing lost comments of copied Trees
Comment 6 Jan Pokorsky 2008-09-16 15:32:27 UTC
*** Issue 147309 has been marked as a duplicate of this issue. ***
Comment 7 Quality Engineering 2011-01-22 06:13:41 UTC
Integrated into 'main-golden', will be available in build *201101220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/51aa6472eeef
User: Jan Lahoda <jlahoda@netbeans.org>
Log: Adding test for #144209.