github / github/codeql

Java: Clarify that Expr.getLocation does not include parentheses

Abierto
#3,908 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Java question
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.