Skip to content

Stop forcibly breaking the method call chain - #322

Open
Taskeren wants to merge 1 commit into
GTNewHorizons:masterfrom
Taskeren:eclipse-format
Open

Taskeren wants to merge 1 commit into
GTNewHorizons:masterfrom
Taskeren:eclipse-format

Conversation

@Taskeren

Copy link
Copy Markdown

Summary

#291

Disable forcibly breaking the method call chain.

Others are the default values generated by Eclipse when I editing the rule. I can remove these changes if needed.

public class App {

    public static String getANotVeryLongString() {
        return "";
    }

    public static String getAVeryLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongString() {
        return "";
    }

    public static void main(String[] args) {
        // won't wrap if the call chain doesn't exceed the line limit (120 characters)
        getANotVeryLongString().toString().toString();
        // only wrap when it's too long.
        getAVeryLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongString()
            .toString()
            .toString();
        // or something like this
        getANotVeryLongString().toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString()
            .toString();

        // so that there won't be something like,
        long someVar = "".chars()
            .count();
        // which doesn't make any sense to break the line.

        // isn't this better than the one above?
        long someVar1 = "".chars().count();
    }
}

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
  • This PR is in compliance with the GTNH AI Policy
  • This PR requires another PR in order to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant