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 246059 - Line comments are lost when performing Convert anonymous to member on class containing only comments
Summary: Line comments are lost when performing Convert anonymous to member on class c...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 246587
Blocks:
  Show dependency tree
 
Reported: 2014-07-28 13:01 UTC by Jiri Prox
Modified: 2014-08-29 07:57 UTC (History)
0 users

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 Jiri Prox 2014-07-28 13:01:35 UTC
Line comments are lost when performing Convert anonymous to member on class containing only comments


code:
private Object foo = new Object() // HINT: Convert anonymous to member
    {
        // TODO        
    };


-> convert anonymous to member
-> 


private static class ObjectImpl extends Object {

        public ObjectImpl() {
        }
    }


Product Version: NetBeans IDE Dev (Build 20140728-44a39f86a838)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Jiri Prox 2014-07-29 14:07:40 UTC
Same for Replace with Lock.lock()- Lock.unlock()

    public void method(Lock lock) {
        synchronized(lock) { //Hint: Replace with Lock.lock()-Lock.unlock()
            //System.out.println("");
            
        }
    }

-->
    public void method(Lock lock) {
        lock.lock();
        try {
        } finally {            
            lock.unlock();
        }
    }
Comment 2 Svata Dedic 2014-08-21 06:56:42 UTC
Partially fixed by jet-main#4a569ddeac6a
Comment 3 Quality Engineering 2014-08-26 02:44:20 UTC
Integrated into 'main-silver', will be available in build *201408260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4a569ddeac6a
User: Svata Dedic <sdedic@netbeans.org>
Log: #246059: partial fix - comments are migrated upwards, class prints INNER comments
Comment 4 Svata Dedic 2014-08-29 07:57:21 UTC
I consider the defect fixed. The comments however remain with the newly created inner class, not with the 'new' expression. Logic that would guess that line comment after { belongs to the preceding expression and not to the class could be too fragile.