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 225107 - Pull Up Method To Abstract Super Class Ads Extraneous Comments
Summary: Pull Up Method To Abstract Super Class Ads Extraneous Comments
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 225108 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-20 01:55 UTC by MackSix
Modified: 2013-01-23 13:10 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project for reproduction of bug (15.17 KB, application/zip)
2013-01-20 01:55 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-01-20 01:55:15 UTC
Created attachment 130409 [details]
project for reproduction of bug

1. Import attached project.
2. Open up all files in editor.
3. Right click on printSomething() method in SubClass.java and Choose Refactor>>Pull Up.
4. Click Refactor.
5. Extraneous comments are added inside the method printSomething() in SuperClass.java as shown below.


   public void printSomething() {
        /*
         * To change this template, choose Tools | Templates
         * and open the template in the editor.
         */
        /**
         *
         * @author MackSix
         */
        System.out.println(ob.toString());
    }

Product Version: NetBeans IDE 7.3 RC1 (Build 201301102100)
Java: 1.7.0_11; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

This does not happen in v7.2.1 or in IDE Dev (Build 201301190001).
Comment 1 MackSix 2013-01-20 05:21:10 UTC
Bug still valid in:

Product Version: NetBeans IDE 7.3 RC1 (Build 201301172100)
Java: 1.7.0_11; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 2 Jan Lahoda 2013-01-20 19:56:50 UTC
An unfortunate interaction between disabled assertions and some other changes made into 7.3 long, long, time ago. Will almost surely be reproducible in trunk with disabled assertions.

Hotfix:
http://hg.netbeans.org/jet-main/rev/cf3650a5a9f8

This fix disabled comment automapping for all trees not belonging into the current source - probably the only realistic fix for 7.3, but long term fix should be:
-never disable comment automapping (keep only the warning enabled on assertions, as checking if the tree is part of the current source is slow)
-when ImmutableTreeTranslator copies comments from one tree to another, copy also the "comments mapped" status. BTW what to do about GeneratorUtilities.copyComments.

This long-term fix currently unfortunately break some refactorings, and is therefore not suitable for 7.3.
Comment 3 Ralph Ruijs 2013-01-20 22:08:37 UTC
*** Bug 225108 has been marked as a duplicate of this bug. ***
Comment 4 MackSix 2013-01-20 22:28:24 UTC
The Extract Interface did the same. I figured it was the same bug. :)
Comment 5 Dusan Balek 2013-01-21 08:54:31 UTC
The hotfix for 7.3 seems to be OK.
Comment 6 Jan Lahoda 2013-01-21 13:33:41 UTC
Jirka, could you please try to verify? To reproduce in dev builds, please disable assertions (-J-da). Thanks in advance.
Comment 7 Jiri Prox 2013-01-21 15:45:08 UTC
the fix seems to be ok, verified in trunk
Comment 8 Quality Engineering 2013-01-22 03:05:29 UTC
Integrated into 'main-golden', will be available in build *201301220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/cf3650a5a9f8
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #225107: hotfix - let TreeUtilities.ensureCommentsMapped not perform the map if the given tree is not from the current compilation unit even if assertions are disabled
Comment 9 Jan Lahoda 2013-01-22 09:12:43 UTC
release73:
http://hg.netbeans.org/releases/rev/8ab467e3a43e
Comment 10 Quality Engineering 2013-01-23 00:03:12 UTC
Integrated into 'releases', will be available in build *201301222100* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/8ab467e3a43e
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #225107: hotfix - let TreeUtilities.ensureCommentsMapped not perform the map if the given tree is not from the current compilation unit even if assertions are disabled