When formatting code idea, method of sequencing problem

problem

Today in the use of idea formatting code, main method will always go to the top of all methods.

Before formatting:

Before formatting

After formatting:

After formatting

solve

I always thought the reason the main method, then google for a long time, did not find what is the reason, but can only go to the official IntelliJ IDEA look at the document.

Finally found clues in the official documents of IntelliJ IDEA.
https://www.jetbrains.com/help/idea/code-style-java.html

In the Arrangement under section explaining the words

This tab lets you define a set of rules that rearranges your code according to your preferences.
This tab allows you to define a set of rules, rearrange the code according to your preferences.

I.e. Matching rules can be arranged under Arrangement, custom methods, fields, etc. are regularly arranged.

Matching rules

The following is the meaning of the static method to sort by name

Matching rules

So my main method will be ran in front of each format, just delete the collation (or to follow your own meaning) can be.

More on ArrangementConfiguration official document reference IDEA IntelliJ
https://www.jetbrains.com/help/idea/code-style-java.html

In https://stackoverflow.com/questions/17435476/intellij-idea-how-to-sort-members-alphabetically a Matching rules of the example, the public, protected, private method or the like sorted order.

Quote

https://www.jetbrains.com/help/idea/code-style-java.html
https://stackoverflow.com/questions/17435476/intellij-idea-how-to-sort-members-alphabetically

Guess you like

Origin www.cnblogs.com/gj-blog/p/10957021.html