Skip to content

Commit d85d009

Browse files
committed
Java: Replace '.prefix'/'.suffix' with '.matches'.
1 parent 5b13232 commit d85d009

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

java/ql/lib/semmle/code/java/frameworks/gigaspaces/GigaSpaces.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ predicate isGigaSpacesEventMethod(Method eventMethod) {
3737
class GigaSpacesSpaceIdGetterMethod extends Method {
3838
GigaSpacesSpaceIdGetterMethod() {
3939
getAnAnnotation().getType().hasQualifiedName("com.gigaspaces.annotation.pojo", "SpaceId") and
40-
getName().prefix(3) = "get"
40+
getName().matches("get%")
4141
}
4242
}
4343

@@ -48,7 +48,7 @@ class GigaSpacesSpaceIdSetterMethod extends Method {
4848
GigaSpacesSpaceIdSetterMethod() {
4949
exists(GigaSpacesSpaceIdGetterMethod getterMethod |
5050
getterMethod.getDeclaringType() = getDeclaringType() and
51-
getName().prefix(3) = "set"
51+
getName().matches("set%")
5252
|
5353
getterMethod.getName().suffix(3) = getName().suffix(3)
5454
)
@@ -62,6 +62,6 @@ class GigaSpacesSpaceIdSetterMethod extends Method {
6262
class GigaSpacesSpaceRoutingMethod extends Method {
6363
GigaSpacesSpaceRoutingMethod() {
6464
getAnAnnotation().getType().hasQualifiedName("com.gigaspaces.annotation.pojo", "SpaceRouting") and
65-
getName().prefix(3) = "get"
65+
getName().matches("get%")
6666
}
6767
}

java/ql/lib/semmle/code/java/frameworks/spring/SpringProfile.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SpringProfileExpr extends string {
3737
* A Spring profile expression that begins with "!", indicating a negated expression.
3838
*/
3939
class NotSpringProfileExpr extends SpringProfileExpr {
40-
NotSpringProfileExpr() { this.prefix(1) = "!" }
40+
NotSpringProfileExpr() { this.matches("!%") }
4141

4242
/**
4343
* Gets the profile described in this profile expression.

java/ql/lib/semmle/code/xml/MavenPom.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Pom extends ProtoPom {
129129
* occurs by considering the properties defined by this project or an ancestor project.
130130
*/
131131
string resolvePlaceholder(string name) {
132-
if name.prefix(8) = "project."
132+
if name.matches("project.%")
133133
then
134134
exists(PomElement p |
135135
p = getProjectProperty() and

0 commit comments

Comments
 (0)