Update OS Check from Review Feedback

This commit is contained in:
Jonathan Leitschuh
2022-02-28 19:43:55 -05:00
parent 9f5022ee95
commit fd63107edf
8 changed files with 164 additions and 39 deletions

View File

@@ -60,6 +60,75 @@ jdk/A.java:
# 28| 0: [ArrayTypeAccess] ...[]
# 28| 0: [TypeAccess] String
# 28| 5: [BlockStmt] { ... }
jdk/StringMatch.java:
# 0| [CompilationUnit] StringMatch
# 1| 1: [Class] StringMatch
# 2| 3: [FieldDeclaration] String STR;
# 2| -1: [TypeAccess] String
# 2| 0: [StringLiteral] "the quick brown fox jumps over the lazy dog"
# 4| 4: [Method] a
# 4| 3: [TypeAccess] void
# 4| 5: [BlockStmt] { ... }
# 5| 0: [ExprStmt] <Expr>;
# 5| 0: [MethodAccess] matches(...)
# 5| -1: [VarAccess] STR
# 5| 0: [StringLiteral] "[a-z]+"
# 8| 5: [Method] b
# 8| 3: [TypeAccess] void
# 8| 5: [BlockStmt] { ... }
# 9| 0: [ExprStmt] <Expr>;
# 9| 0: [MethodAccess] contains(...)
# 9| -1: [VarAccess] STR
# 9| 0: [StringLiteral] "the"
# 12| 6: [Method] c
# 12| 3: [TypeAccess] void
# 12| 5: [BlockStmt] { ... }
# 13| 0: [ExprStmt] <Expr>;
# 13| 0: [MethodAccess] startsWith(...)
# 13| -1: [VarAccess] STR
# 13| 0: [StringLiteral] "the"
# 16| 7: [Method] d
# 16| 3: [TypeAccess] void
# 16| 5: [BlockStmt] { ... }
# 17| 0: [ExprStmt] <Expr>;
# 17| 0: [MethodAccess] endsWith(...)
# 17| -1: [VarAccess] STR
# 17| 0: [StringLiteral] "dog"
# 20| 8: [Method] e
# 20| 3: [TypeAccess] void
# 20| 5: [BlockStmt] { ... }
# 21| 0: [ExprStmt] <Expr>;
# 21| 0: [MethodAccess] indexOf(...)
# 21| -1: [VarAccess] STR
# 21| 0: [StringLiteral] "lazy"
# 24| 9: [Method] f
# 24| 3: [TypeAccess] void
# 24| 5: [BlockStmt] { ... }
# 25| 0: [ExprStmt] <Expr>;
# 25| 0: [MethodAccess] lastIndexOf(...)
# 25| -1: [VarAccess] STR
# 25| 0: [StringLiteral] "lazy"
# 28| 10: [Method] g
# 28| 3: [TypeAccess] void
# 28| 5: [BlockStmt] { ... }
# 29| 0: [ExprStmt] <Expr>;
# 29| 0: [MethodAccess] regionMatches(...)
# 29| -1: [VarAccess] STR
# 29| 0: [IntegerLiteral] 0
# 29| 1: [StringLiteral] "fox"
# 29| 2: [IntegerLiteral] 0
# 29| 3: [IntegerLiteral] 4
# 32| 11: [Method] h
# 32| 3: [TypeAccess] void
# 32| 5: [BlockStmt] { ... }
# 33| 0: [ExprStmt] <Expr>;
# 33| 0: [MethodAccess] regionMatches(...)
# 33| -1: [VarAccess] STR
# 33| 0: [BooleanLiteral] true
# 33| 1: [IntegerLiteral] 0
# 33| 2: [StringLiteral] "FOX"
# 33| 3: [IntegerLiteral] 0
# 33| 4: [IntegerLiteral] 4
jdk/SystemGetPropertyCall.java:
# 0| [CompilationUnit] SystemGetPropertyCall
# 3| 1: [Class] SystemGetPropertyCall

View File

@@ -0,0 +1,8 @@
| jdk/StringMatch.java:5:9:5:29 | matches(...) | jdk/StringMatch.java:5:21:5:28 | "[a-z]+" |
| jdk/StringMatch.java:9:9:9:27 | contains(...) | jdk/StringMatch.java:9:22:9:26 | "the" |
| jdk/StringMatch.java:13:9:13:29 | startsWith(...) | jdk/StringMatch.java:13:24:13:28 | "the" |
| jdk/StringMatch.java:17:9:17:27 | endsWith(...) | jdk/StringMatch.java:17:22:17:26 | "dog" |
| jdk/StringMatch.java:21:9:21:27 | indexOf(...) | jdk/StringMatch.java:21:21:21:26 | "lazy" |
| jdk/StringMatch.java:25:9:25:31 | lastIndexOf(...) | jdk/StringMatch.java:25:25:25:30 | "lazy" |
| jdk/StringMatch.java:29:9:29:41 | regionMatches(...) | jdk/StringMatch.java:29:30:29:34 | "fox" |
| jdk/StringMatch.java:33:9:33:47 | regionMatches(...) | jdk/StringMatch.java:33:36:33:40 | "FOX" |

View File

@@ -0,0 +1,5 @@
import java
from MethodAccess ma, StringPartialMatchMethod m
where ma.getMethod() = m
select ma, ma.getArgument(m.getMatchParameterIndex())

View File

@@ -0,0 +1,35 @@
public class StringMatch {
private static String STR = "the quick brown fox jumps over the lazy dog";
void a() {
STR.matches("[a-z]+");
}
void b() {
STR.contains("the");
}
void c() {
STR.startsWith("the");
}
void d() {
STR.endsWith("dog");
}
void e() {
STR.indexOf("lazy");
}
void f() {
STR.lastIndexOf("lazy");
}
void g() {
STR.regionMatches(0, "fox", 0, 4);
}
void h() {
STR.regionMatches(true, 0, "FOX", 0, 4);
}
}