File tree Expand file tree Collapse file tree 3 files changed +703
-0
lines changed Expand file tree Collapse file tree 3 files changed +703
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Tool to generate java stubs from a qltest snapshot.
3
+ *
4
+ * It finds all declarations used in the source code,
5
+ * and generates minimal java stubs containing those declarations
6
+ * and their dependencies.
7
+ */
8
+
9
+ import java
10
+ import Stubs
11
+
12
+ /** Declarations used by source code. */
13
+ class UsedInSource extends GeneratedDeclaration {
14
+ UsedInSource ( ) {
15
+ (
16
+ this = any ( Variable v | v .fromSource ( ) ) .getType ( )
17
+ or
18
+ this = any ( Expr e | e .getEnclosingCallable ( ) .fromSource ( ) ) .getType ( )
19
+ or
20
+ this = any ( RefType t | t .fromSource ( ) )
21
+ or
22
+ this = any ( TypeAccess ta | ta .fromSource ( ) )
23
+ )
24
+ }
25
+ }
26
+
27
+ from GeneratedTopLevel t
28
+ where not t .fromSource ( )
29
+ select t .getQualifiedName ( ) , t .stubFile ( )
30
+
31
+ module Consistency {
32
+ query predicate noGeneratedStubs ( string s ) {
33
+ exists ( GeneratedTopLevel t | s = t .getQualifiedName ( ) |
34
+ not t .fromSource ( ) and
35
+ not exists ( t .stubFile ( ) )
36
+ )
37
+ }
38
+
39
+ query predicate multipleGeneratedStubs ( string s ) {
40
+ exists ( GeneratedTopLevel t | s = t .getQualifiedName ( ) |
41
+ not t .fromSource ( ) and
42
+ strictcount ( t .stubFile ( ) ) > 1
43
+ )
44
+ }
45
+ }
46
+
47
+ import Consistency
You can’t perform that action at this time.
0 commit comments