Skip to content

Commit 22b614a

Browse files
committed
Use set literals
1 parent 62238fc commit 22b614a

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

java/ql/lib/semmle/code/java/JDK.qll

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,7 @@ class WriteObjectMethod extends Method {
321321
class ReadObjectMethod extends Method {
322322
ReadObjectMethod() {
323323
this.getDeclaringType() instanceof TypeObjectInputStream and
324-
(
325-
this.hasName("readObject") or
326-
this.hasName("readObjectOverride") or
327-
this.hasName("readUnshared") or
328-
this.hasName("resolveObject")
329-
)
324+
this.hasName(["readObject", "readObjectOverride", "readUnshared", "resolveObject"])
330325
}
331326
}
332327

java/ql/lib/semmle/code/java/frameworks/struts/StrutsActions.qll

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,15 @@ class Struts2ActionClass extends Class {
4040
getStrutsMapperClass(this) = "org.apache.struts2.dispatcher.mapper.RestfulActionMapper"
4141
then
4242
// The "Restful" action mapper maps rest APIs to specific methods
43-
result.hasName("index") or
44-
result.hasName("create") or
45-
result.hasName("editNew") or
46-
result.hasName("view") or
47-
result.hasName("remove") or
48-
result.hasName("update")
43+
result.hasName(["index", "create", "editNew", "view", "remove", "update"])
4944
else
5045
if
5146
getStrutsMapperClass(this) = "org.apache.struts2.rest.RestActionMapper" or
5247
getStrutsMapperClass(this) = "rest"
5348
then
5449
// The "Rest" action mapper is provided with the rest plugin, and maps rest APIs to specific
5550
// methods based on a "ruby-on-rails" style.
56-
result.hasName("index") or
57-
result.hasName("show") or
58-
result.hasName("edit") or
59-
result.hasName("editNew") or
60-
result.hasName("create") or
61-
result.hasName("update") or
62-
result.hasName("destroy")
51+
result.hasName(["index", "show", "edit", "editNew", "create", "update", "destroy"])
6352
else
6453
if exists(getStrutsMapperClass(this))
6554
then

0 commit comments

Comments
 (0)