3/18
一、 前言 ................................................................................................................................... 4
1.1、 目的 ........................................................................................................................... 4
1.2、范围 .................................................................................................................................. 4
二、 格式规范 ........................................................................................................................... 5
2.1 缩进 ............................................................................................................................ 5
2.2 换行 .................................................................................................................................... 5
2.3 间隔 .................................................................................................................................... 5
2.4 对齐 .................................................................................................................................... 5
2.5 括号 .................................................................................................................................... 5
三、注释规范 ................................................................................................................................... 6
3.1 基本原则 .................................................................................................................... 6
3.2 文件注释 .................................................................................................................... 6
3.3 Java Doc 注释 ............................................................................................................ 7
3.4 失效代码注释 ............................................................................................................ 7
3.5 代码细节注释 ............................................................................................................ 8
3.6 注释的格式 ................................................................................................................ 8
3.7 注释的内容 ................................................................................................................ 8
3.8 Null 规约 .................................................................................................................... 9
4 命名规范 (Naming Conventions) ................................................................................................ 10
4.1 基本约定 .................................................................................................................. 10
4.2 文件、包 .................................................................................................................. 10
4.3 类、接口 .................................................................................................................. 10
4.4 字段 .......................................................................................................................... 11
5 编程规范 (Programming Conventions) ....................................................................................... 12
5.1 基本规范 .................................................................................................................. 12
5.2 类与接口 .................................................................................................................. 12
5.3 方法 .......................................................................................................................... 13
5.4 错误与异常 .............................................................................................................. 13
5.5 JDK5.0 及后续版本 ................................................................................................ 14
5.6 性能与安全 .............................................................................................................. 14
6 自动代码检查和修正 ................................................................................................................. 16
6.1 为了编码的一致性,统一将 Workspace 中的编码方式设置为 UTF-8 编码 ..... 16
6.2 使用统一的代码模板 ............................................................................................... 16