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 156616 - [formatting] Switch statement not formatted correctly
Summary: [formatting] Switch statement not formatted correctly
Status: REOPENED
Alias: None
Product: groovy
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks: 224640
  Show dependency tree
 
Reported: 2009-01-12 13:58 UTC by Lukas Jungmann
Modified: 2013-01-09 11:31 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 Lukas Jungmann 2009-01-12 13:58:50 UTC
-have a switch statement in java and invoke reformat on the source containing it

=> one gets ie:

        int i = 0;
        switch (i) {
            case 1:
                System.out.println("q");
                break;
            case 2:
                System.out.println("s");
                break;
            default:
                System.out.println("def");
        }

-do the same in a groovy file

=> one gets (unformatted):

        switch (node) {
            case "customers" :
            click "links.customersExpander"
            break
            case "dCodes" :
            click "links.dcodesExpander"
            break
            default:
            throw new UnsupportedOperationException("$node not implemented")
        }
Comment 1 nikel303 2009-03-07 04:32:38 UTC

*** This issue has been marked as a duplicate of 152429 ***
Comment 2 Petr Hejl 2009-03-07 19:22:52 UTC
I don't think it is a duplicate.
Comment 3 Martin Janicek 2011-12-05 16:17:03 UTC
Still valid issue. Setting TM --> 7.2
Comment 4 Martin Janicek 2012-03-28 07:21:34 UTC
At least small improvement for now in revision: web-main #34f85394c623
Now we get:

        int i = 0;
        switch (i) {
	case 1:
	    System.out.println("q");
	    break;
	case 2:
	    System.out.println("s");
	    break;
	default:
	    System.out.println("def");
        }

Ideally we should have:

        int i = 0;
        switch (i) {
	    case 1:
	        System.out.println("q");
	        break;
	    case 2:
	        System.out.println("s");
	        break;
	    default:
	        System.out.println("def");
        }
Comment 5 Martin Janicek 2012-03-28 07:22:50 UTC
Mmm, bugzilla formatting screw it up. Another try..

Now we get:

    int i = 0;
    switch (i) {
    case 1:
        System.out.println("q");
        break;
    case 2:
        System.out.println("s");
        break;
    default:
        System.out.println("def");
        }

Ideally we should have:

    int i = 0;
    switch (i) {
        case 1:
            System.out.println("q");
            break;
        case 2:
            System.out.println("s");
            break;
        default:
            System.out.println("def");
    }