github / github/codeql

Java: Clarify that Expr.getLocation does not include parentheses

Aberta
#3,908 0 comentários 0 reações 0 responsáveis Ver no GitHub
Java question
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

**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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.