Skip to content

Commit 794fd97

Browse files
committed
Add androidx Fragment support
1 parent 93fc952 commit 794fd97

26 files changed

+740
-334
lines changed

java/ql/lib/semmle/code/java/frameworks/android/Fragment.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import java
44

55
/** The class `android.app.Fragment`. */
66
class AndroidFragment extends Class {
7-
AndroidFragment() { this.getAnAncestor().hasQualifiedName("android.app", "Fragment") }
7+
AndroidFragment() {
8+
this.getAnAncestor().hasQualifiedName(["android.app", "androidx.fragment.app"], "Fragment")
9+
}
810
}
911

1012
/** The method `instantiate` of the class `android.app.Fragment`. */
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import androidx.fragment.app.Fragment;
2+
3+
public class TestFragment extends Fragment {
4+
class SecondFragment extends android.app.Fragment {
5+
}
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/google-android-9.0.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| TestFragment.java:3:14:3:25 | TestFragment |
2+
| TestFragment.java:4:11:4:24 | SecondFragment |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import java
2+
import semmle.code.java.frameworks.android.Fragment
3+
4+
from AndroidFragment f
5+
where f.getFile().getBaseName() = "TestFragment.java"
6+
select f

java/ql/test/stubs/google-android-9.0.0/androidx/core/app/ActivityCompat.java

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/androidx/core/app/SharedElementCallback.java

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/androidx/core/content/ContextCompat.java

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/androidx/core/view/DragAndDropPermissionsCompat.java

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/google-android-9.0.0/androidx/fragment/app/BackStackRecord.java

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)