美文网首页Spring
Spring官方IntelliJ IDEA Editor Set

Spring官方IntelliJ IDEA Editor Set

作者: mitsuii | 来源:发表于2018-11-08 13:19 被阅读0次

这篇文章描述的是和Intellij IDEA默认的代码格式化设置明显差异性的配置。同时也检查这些差异配置的有效性,后者在必要的地方做轻微调整。

Issues


下面是报告的问题我们还在讨论的,第一个是我们使用的方式。

∆ 注解参数中空格的用法:@Foo(name="foo") vs. @Foo(name = "foo")

∆ 注解数组参数中空格的用法:@Target({ ElementType.METHOD, ElementType.TYPE }) vs. @Target({ElementType.METHOD, ElementType.TYPE})

General


∆ 默认的缩进使用tab取代空格

Java


Tabs and indent

∆ 使用tab缩进

Spaces 

∆ 在数组初始化器的左括号之前添加一个空格

Wrapping and braces

∆ 重新格式化时保持:多个表达式在一行,简单代码块在一行,简单类在一行

∆ else, catch and finally 使用新的一行

∆ 方法声明参数:不要把多行对齐

Blank lines

∆ 在}前保留一个空格(在最后一个方法和类的最后一行 单独留一个空行)

∆ 类的头部最小限度留空行

Javadoc

∆ 禁止

Imports

∆ Use 100 for "Class count to use import with *" so that imported classes are always listed individually

∆ Use 0 for "Names count to use static imports with *" since static imports are only allowed in test sources where they can and should be aggregated, e.g. import static org.junit.Assert.*;.

∆ 使用下面的引用顺序:

java.*

javax.*

<blank line>

all other imports

<blank line>

org.springframework.*

import static all other methods

阅读原文IntelliJ-IDEA-Editor-Settings

相关文章

网友评论

    本文标题:Spring官方IntelliJ IDEA Editor Set

    本文链接:https://www.haomeiwen.com/subject/rrqwxqtx.html