Skip to content

Commit 3d21f89

Browse files
committed
Exclude .kt files from autoboxing query
1 parent 0d9e280 commit 3d21f89

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

java/ql/src/Violations of Best Practice/legacy/AutoBoxing.ql

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ predicate rebox(Assignment e, Variable v) {
7272

7373
from Expr e, string conv
7474
where
75-
boxed(e) and conv = "This expression is implicitly boxed."
76-
or
77-
unboxed(e) and conv = "This expression is implicitly unboxed."
78-
or
79-
exists(Variable v | rebox(e, v) |
80-
conv =
81-
"This expression implicitly unboxes, updates, and reboxes the value of '" + v.getName() + "'."
75+
e.getFile().isJavaSourceFile() and
76+
(
77+
boxed(e) and conv = "This expression is implicitly boxed."
78+
or
79+
unboxed(e) and conv = "This expression is implicitly unboxed."
80+
or
81+
exists(Variable v | rebox(e, v) |
82+
conv =
83+
"This expression implicitly unboxes, updates, and reboxes the value of '" + v.getName() +
84+
"'."
85+
)
8286
)
8387
select e, conv
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
| Test.kt:3:17:3:17 | x | This expression is implicitly unboxed. |

0 commit comments

Comments
 (0)