github / github/codeql

Java: Clarify that Expr.getLocation does not include parentheses

Aperta
#3,908 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Java question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

**Description of the issue**
The name of the predicate `Expr.isParenthesized()` suggests that parentheses are considered part of the expression (a name like `isEnclosedInParentheses` or similar would suggest the opposite).
However, it appears `Expr.getLocation` does not consider parentheses to be part of the expression.
Example query:
```ql
import java

string locationToString(Location l) {
result = l.getStartLine() + "[" + l.getStartColumn() + "]-"
+ l.getEndLine() + "[" + l.getEndColumn() + "]"
}

from Expr e
where
e.isParenthesized()
select e, locationToString(e.getLocation())
```
[Query console](https://lgtm.com/query/4021771571886901977/)

It would therefore be good to clarify this in the `Expr.getLocation` documentation.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.