github / github/codeql

Java: JavadocElement location is off by one

Open
#5,816 1 comment 1 reaction 0 assignees View on GitHub
Java question
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

### Version
CodeQL CLI v.2.5.2

### Description
It appears for every `JavadocElement` the location within the Java source is off by one, and this adds up for every subsequent element.

### Example
Java source:
```java
/**
* test1234567890
* test1234567890
* test1234567890
* test1234567890
* test1234567890
* @author test1234567890
* @author test1234567890
* @author test1234567890
* @author test1234567890
* @author test1234567890
*/
class Test {
}
```

Code QL query:
```ql
import java

from JavadocElement j
select j, j.getLocation().getStartColumn()
```

Run the query for example in VSCode and click on each of the results
:x: Each `JavadocElement` is shifted to the left by one (in addition to the offset of previous elements):
![VSCode extension screenshot](https://user-images.githubusercontent.com/11685886/116763699-ae016580-aa1e-11eb-8ee8-b0cb9a7845d7.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.