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 128456 - [68cat] Wrong formatting for CC-generated anonymous class implementation
Summary: [68cat] Wrong formatting for CC-generated anonymous class implementation
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-26 16:00 UTC by matthies
Modified: 2016-07-07 07:17 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 matthies 2008-02-26 16:00:31 UTC
When using code completion to complete "Runnable r = new Runnabl", I get the following result with my formatting 
options:

    Runnable r = new Runnable() {

        public void run()
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

There are two things that are wrong with the result:

1) The opening brace after "new Runnable()" should be on the next line, as I have "Braces Placement" set to "New Line" 
for "Class Declaration" in the Formatting options. (!nd also for "Other" in case that matters--which I don't think it 
should.)

2) There should be no blank line before the run() method implementation, as I have "Blank Lines" set to 0 for "After 
Class Header" in the Formatting options. The "Before Method" setting should not be applied at the beginning of a class 
body (see issue 110176).

In general, the generated code should have the same formatting as Source -> Format would produce. With the example 
above, this would be:

    Runnable = new Runnable()
    {
        public void run()
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 1 Jiri Prox 2008-02-27 08:22:32 UTC
This is partially fixed in 6.1, the only thing which has to by fixed is position of opening '{' when the code is
generated. After reformat it moved to correct position. -> this is IMO only a minor complication -> P4
Comment 2 Rastislav Komara 2009-02-03 10:52:29 UTC
Overtake.
Comment 3 Jan Lahoda 2009-08-20 09:58:03 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 4 Martin Balin 2016-07-07 07:17:53 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss