File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,30 @@ class UsedInSource extends GeneratedDeclaration {
18
18
this = any ( Expr e | e .getEnclosingCallable ( ) .fromSource ( ) ) .getType ( )
19
19
or
20
20
this = any ( RefType t | t .fromSource ( ) )
21
+ or
22
+ this = any ( TypeAccess ta | ta .fromSource ( ) )
21
23
)
22
24
}
23
25
}
24
26
25
27
from GeneratedTopLevel t
26
28
where not t .fromSource ( )
27
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
Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ private class IndirectType extends GeneratedType {
128
128
this = getAContainedType ( t .getAGeneratedType ( ) ) .( RefType ) .getSourceDeclaration ( )
129
129
)
130
130
or
131
+ this .getSourceDeclaration ( ) instanceof GeneratedType
132
+ or
133
+ this = any ( GeneratedType t ) .getSourceDeclaration ( )
134
+ or
131
135
exists ( GeneratedType t | this = t .( BoundedType ) .getATypeBound ( ) .getType ( ) )
132
136
or
133
137
exists ( GeneratedDeclaration decl |
Original file line number Diff line number Diff line change @@ -120,10 +120,21 @@ def run(cmd):
120
120
with open (outputJsonFile ) as f :
121
121
results = json .load (f )
122
122
123
- if not '#select' in results or not 'tuples' in results ['#select' ]:
123
+ try :
124
+ results ['#select' ]['tuples' ]
125
+ results ['noGeneratedStubs' ]['tuples' ]
126
+ results ['multipleGeneratedStubs' ]['tuples' ]
127
+ except ValueError :
124
128
print ('Unexpected JSON output - no tuples found' )
125
129
exit (1 )
126
130
131
+ for (typ ,) in results ['noGeneratedStubs' ]['tuples' ]:
132
+ print (f"WARNING: No stubs generated for { typ } . This is probably a bug." )
133
+
134
+ for (typ ,) in results ['multipleGeneratedStubs' ]['tuples' ]:
135
+ print (
136
+ f"WARNING: Multiple stubs generated for { typ } . This is probably a bug. One will be chosen arbitrarily." )
137
+
127
138
for (typ , stub ) in results ['#select' ]['tuples' ]:
128
139
stubFile = os .path .join (stubDir , typ .replace ("." , "/" ) + ".java" )
129
140
os .makedirs (os .path .dirname (stubFile ), exist_ok = True )
You can’t perform that action at this time.
0 commit comments