mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Merge pull request #11707 from smowton/smowton/fix/java-empty-multiline-comment
Java: handle printing an empty comment (/**/); add relevant tests
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: fix
|
||||
---
|
||||
* We now correctly handle empty block comments, like `/**/`. Previously these could be mistaken for Javadoc comments and led to attribution of Javadoc tags to the wrong declaration.
|
||||
@@ -33,7 +33,11 @@ class Javadoc extends JavadocParent, @javadoc {
|
||||
string getAuthor() { result = this.getATag("@author").getChild(0).toString() }
|
||||
|
||||
override string toString() {
|
||||
result = this.toStringPrefix() + this.getChild(0) + this.toStringPostfix()
|
||||
exists(string childStr |
|
||||
if exists(this.getChild(0)) then childStr = this.getChild(0).toString() else childStr = ""
|
||||
|
|
||||
result = this.toStringPrefix() + childStr + this.toStringPostfix()
|
||||
)
|
||||
}
|
||||
|
||||
private string toStringPrefix() {
|
||||
@@ -48,7 +52,7 @@ class Javadoc extends JavadocParent, @javadoc {
|
||||
if isEolComment(this)
|
||||
then result = ""
|
||||
else (
|
||||
if strictcount(this.getAChild()) = 1 then result = " */" else result = " ... */"
|
||||
if strictcount(this.getAChild()) > 1 then result = " ... */" else result = " */"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user