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 197865 - "Assign Return Value To New Variable" indentation of multiline statements
Summary: "Assign Return Value To New Variable" indentation of multiline statements
Status: RESOLVED DUPLICATE of bug 224859
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 223362 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-19 13:34 UTC by matthies
Modified: 2013-06-24 11:22 UTC (History)
1 user (show)

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 2011-04-19 13:34:40 UTC
Applying "Assign Return Value To New Variable" to a multiline statement also indents the lines following the first line. For example, applying the hint on

    private static void example()
    {
        System.out
            .append("foo")
            .append("bar");
    }

results in:

    private static void example()
    {
        PrintStream append = System.out
                                 .append("foo")
                                 .append("bar");
    }

This is inconsistent with the usual indentation behavior (upon pressing Enter, or using Source->Format) which uses the configured Continuation Indentation Size.

I would suggest to have the hint only modify the first line, and leave the remaining lines of the statement unmodified. E.g. the result in the above example would be

    private static void example()
    {
        PrintStream append = System.out
            .append("foo")
            .append("bar");
    }

just as it would be when pressing Enter after "PrintStream append = System.out" and then typing ".append(...)".
Comment 1 Jan Lahoda 2012-12-06 07:01:32 UTC
*** Bug 223362 has been marked as a duplicate of this bug. ***
Comment 2 Jan Lahoda 2013-06-24 11:22:32 UTC
After fixing bug #224859, the standard indenter is used to indent the result in this case, and the indetation result should be the same as if the copied part of the code would be reindented.

*** This bug has been marked as a duplicate of bug 224859 ***