-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathMinimalStubsFromSource.ql
More file actions
49 lines (43 loc) · 1.18 KB
/
MinimalStubsFromSource.ql
File metadata and controls
49 lines (43 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Tool to generate java stubs from a qltest snapshot.
*
* It finds all declarations used in the source code,
* and generates minimal java stubs containing those declarations
* and their dependencies.
*/
import java
import Stubs
/** Declarations used by source code. */
class UsedInSource extends GeneratedDeclaration {
UsedInSource() {
(
this = any(Variable v | v.fromSource()).getType()
or
this = any(Expr e | e.getEnclosingCallable().fromSource()).getType()
or
this = any(RefType t | t.fromSource())
or
this = any(TypeAccess ta | ta.fromSource())
or
this = any(Annotation a | a.getAnnotatedElement().fromSource()).getType()
)
}
}
from GeneratedTopLevel t
where not t.fromSource()
select t.getQualifiedName(), t.stubFile()
module Consistency {
query predicate noGeneratedStubs(string s) {
exists(GeneratedTopLevel t | s = t.getQualifiedName() |
not t.fromSource() and
not exists(t.stubFile())
)
}
query predicate multipleGeneratedStubs(string s) {
exists(GeneratedTopLevel t | s = t.getQualifiedName() |
not t.fromSource() and
strictcount(t.stubFile()) > 1
)
}
}
import Consistency