![]() Improve code readability by grouping individual statements into block statements and uniformly indent the content of each block to set off its contents from the surrounding code. Limit your source code line length to 100 characters. ![]() Some source code files contain UTF-8 characters and will be damaged if you modify them with an editor that does not support UTF-8 encoding. Use UTF-8 file encoding and Unix line separators. Formatter settings for Eclipse and IntelliJ are covered first, followed by more detailed descriptions. ![]() Most of the formatting conventions for this project center around the use of white space and the placement of brackets. In order to create a source base that has a unified appearance and is easy to read and comprehend we include conventions for formatting Java code. This includes code documentation (javadocs). Rewriting old code simply to change its style may result in the introduction of costly yet avoidable defects.Īpply these rules to any code you write, not just code destined for production or only if it is visible to the user. The use of different styles within a single source file produces code that is more difficult to read and comprehend. Do not introduce a new coding style in a modification, and do not attempt to rewrite the old software just to make it match the new style. When modifying existing software, your changes should follow the style of the original code. al.Īs an open-source project we are following the Google Java Style guide, emphasizing a few of the more important points in this page. Press Control+Alt+S to open the IDE settings and then select Tools | Actions on Save.Īdditionally, you can click Configure arrangement rules to specify the rules for reordering code elements for the selected language.Java code for the Geode project was originally developed using conventions based on The Elements of Java Style, by A. You can configure the IDE to rearrange code elements in modified files automatically when your changes are saved. ![]() In the editor, select the code entries you want to rearrange and go to Code | Rearrange Code. Press Control+Alt+S to open the IDE settings and then select Editor | Code Style. For more information, refer to Exclude files from reformatting. You can exclude specific files and folders from arrangement. Section rules let you move methods or variables into the sections that you have defined.Īfter the arrangement, methods in the class will be rearranged as specified in the created section rule and will be surrounded by comments. The created alias can now be referred to when adding a matching rule. In the Rules Alias Definitions dialog that opens, add a group name and its rules. With aliases, you can group several arrangement rules into a single entity and refer to it when you are adding a new matching rule. You can also create groups (aliases) of rules and refer to them when creating a new matching rule. To sort code entries alphabetically, select the appropriate Matching rules entry and set the Order field to order by name. The match is performed against the entire name. The filter supports regular expressions and uses the standard syntax. This filter matches only entry names, such as property names, method names, class names, and so on. Use the Name field to specify entry names the rule should affect. Note that double-clicking a filter negates the condition. Use the Type and Modifier filters to choose the code constructs and their visibility modifiers that should be regulated by the rule. On the Arrangement tab, click and provide the rule parameters in the Matching rules area. Matching rules let you define the order of elements as a list of rules, where every rule has a set of matching conditions, such as modifier or type. The former will arrange the methods according to the nesting hierarchy the latter will group together the sibling methods from the same nesting level. On the Arrangement tab, choose the grouping options in the Grouping rules area.įor the Keep dependent methods together option, you can select depth-first order or breadth-first order. Press Control+Alt+S to open the IDE settings and select Editor | Code Style | Java. Grouping rules let you keep related class methods together. You can also create groups (aliases) of rules and refer to them when you create a matching rule. You can rearrange your code according to the arrangement rules set in the Code Style page of the Settings dialog.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |