mirror of
https://github.com/github/codeql.git
synced 2026-04-23 15:55:18 +02:00
add link to the source variable in the alert-message for java/implicit-cast-in-compound-assignment
This commit is contained in:
@@ -27,10 +27,11 @@ class DangerousAssignOpExpr extends AssignOp {
|
||||
|
||||
predicate problematicCasting(Type t, Expr e) { e.getType().(NumType).widerThan(t) }
|
||||
|
||||
from DangerousAssignOpExpr a, Expr e
|
||||
from DangerousAssignOpExpr a, Expr e, Variable v
|
||||
where
|
||||
e = a.getSource() and
|
||||
problematicCasting(a.getDest().getType(), e)
|
||||
problematicCasting(a.getDest().getType(), e) and
|
||||
v = a.getDest().(VarAccess).getVariable()
|
||||
select a,
|
||||
"Implicit cast of source type " + e.getType().getName() + " to narrower destination type " +
|
||||
a.getDest().getType().getName() + "."
|
||||
"Implicit cast of source $@ to narrower destination type " + a.getDest().getType().getName() + ".",
|
||||
v, "type " + e.getType().getName()
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
| Test.java:68:5:68:25 | ...+=... | Implicit cast of source type long to narrower destination type int. |
|
||||
| Test.java:87:4:87:9 | ...+=... | Implicit cast of source type long to narrower destination type int. |
|
||||
| Test.java:68:5:68:25 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:64:4:64:13 | int i | type long |
|
||||
| Test.java:87:4:87:9 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:81:4:81:13 | int i | type long |
|
||||
|
||||
Reference in New Issue
Block a user