java - Checkstyle:单行 Java 注释在两个斜杠后是否应该有空格?
问题描述
似乎没有默认的 Checkstyle 检查,也没有默认的 Google Checkstyle 检查来确保单行注释的格式如下:
// comment text
而不是这样:
//comment text
Java 语言规范的第 3.7 节“注释”中暗示了此约定:
3.7. 注释
有两种评论:
/* text */ A traditional comment: all the text from the ASCII characters /* to the ASCII characters */ is ignored (as in C and C++). // text An end-of-line comment: all the text from the ASCII characters // to the end of the line is ignored (as in C++).
总而言之,它似乎是Java本身的必要条件,例如在http://hg.openjdk.java.net/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/src/share/classes/java/lang/String.java
这是一致的,因此显然是经过深思熟虑的。
因此,省略两个斜线和评论文本之间的空格在客观上是不正确的吗?
是否有一个著名的 Checkstyle 检查扩展库,其中包含对此的检查?
解决方案
推荐阅读
- logstash - 如何在 Kibana/Logstash 中对日志进行分组?
- python-3.x - 使用 selenium 和代理获取请求正文
- ios - 使用 iOS 图表在自定义标记视图上点击手势
- c - 我可以在图表的边缘插入数据吗?
- kubernetes - Kubernetes CNI 与 Kube-proxy
- php - 如何每批读取文件 .csv
- php - 如何判断 CakePHP 3.x 中的调试模式是否开启
- highcharts - 在 highcharts 热图中缺少系列名称作为标签
- ruby-on-rails - Rails 中的匿名控制器
- html - MS-Word 中的 base 64 图像