github / github/codeql

Java: Javadoc matches regular comments

Đang mở
#3,695 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Java question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**Description of the issue**
It appears `Javadoc` and some of the related classes match regular comments. This is pretty misleading because normally javadoc only refers to `/** ... */`, neither any of the QL classes nor the documentation of the containing module mentions this.
The [Learn QL: Javadoc](https://github.com/github/codeql/blob/master/docs/language/learn-ql/java/javadoc.rst) does not mention this either.

Similarly the concept of javadoc tags does not apply to regular comments (interestingly QL seems to honor that and does not find any in regular comments).

Example query:
```ql
from Javadoc javadoc
where
not exists (javadoc.getCommentedElement())
// Exclude license headers, though they are not javadoc either
and javadoc.getLocation().getStartLine() > 10
select javadoc
```

If you decide to stick to this decision, could the documentation of the QL classes and the module please be clarified and could respective predicates for comment types be added (though it might be hard to choose predicate names which are not misleading):
- is block comment (the JLS calls them ["traditional comment"](https://docs.oracle.com/javase/specs/jls/se14/html/jls-3.html#jls-3.7), though that is not very meaningful)
- is line comment

The currently existing predicate `getCommentedElement()` is not enough to determine whether it is a javadoc comment or a regular comment (since one could place `/** ... */` anywhere).
`semmlecode.dbscheme` provides `isNormalComment(@javadoc)`, but is that an implementation detail or may it be used?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.