Google的java代码规范-import规范

No wildcard imports

Wildcard imports, static or otherwise, are not used.

No line-wrapping

Import statements are not line-wrapped. The column limit (Section 4.4,
Column limit: 100) does not apply to import statements.

Ordering and spacing

Imports are ordered as follows: All static imports in a single block.
All non-static imports in a single block.
If there are both static andnon-static imports, a single blank line separates the two blocks.
There are no other blank lines between import statements.
Within each block the imported names appear in ASCII sort order.
(Note: this is not the same as the import statements being in ASCII
sort order, since ‘.’ sorts before ‘;’.)

No static import for classes

Static import is not used for static nested classes. They are imported
with normal imports.

下面是原文翻译
*1,不可使用通配符导入(即.形式的导入)

不使用通配符导入(静态或其他)。

2,不换行

导入语句不换行。列限制(第4.4节,列限制:100)不适用于导入语句。

3,排序和间距

所有静态导入都在一个块中; 所有非静态导入都在一个块中; 如果同时存在静态和非静态导入,则用一条空行分隔两个块。
除此之外,导入语句之间没有其他空行。

4,在每个导入的块中,导入顺序按照ASCII排序顺序。

注意:这与使用ASCII排序顺序的import语句不同,因为“.”在“;”之前排序。

5,没有类的静态导入

静态导入不用于静态嵌套类。它们是用正常的其他导入一起的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值