File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
java/ql/src/utils/stub-generator Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -285,15 +285,25 @@ private string stubQualifier(RefType t) {
285285 else result = ""
286286}
287287
288+ pragma [ nomagic]
289+ private predicate needsPackageNameHelper ( RefType t , GeneratedTopLevel top , string name ) {
290+ t .getSourceDeclaration ( ) =
291+ pragma [ only_bind_out ] ( [ getAReferencedType ( top ) , top ] .getSourceDeclaration ( ) ) and
292+ name = t .getName ( )
293+ }
294+
295+ pragma [ nomagic]
296+ private predicate describesMultipleTypes ( GeneratedTopLevel top , string name ) {
297+ 2 <= strictcount ( RefType t | needsPackageNameHelper ( t , top , name ) )
298+ }
299+
288300/**
289301 * Holds if `t` may clash with another type of the same name, so should be referred to using the fully qualified name
290302 */
291303private predicate needsPackageName ( RefType t ) {
292- exists ( GeneratedTopLevel top , RefType other |
293- t .getSourceDeclaration ( ) = [ getAReferencedType ( top ) , top ] .getSourceDeclaration ( ) and
294- other .getSourceDeclaration ( ) = [ getAReferencedType ( top ) , top ] .getSourceDeclaration ( ) and
295- t .getName ( ) = other .getName ( ) and
296- t != other
304+ exists ( GeneratedTopLevel top , string name |
305+ needsPackageNameHelper ( t , top , name ) and
306+ describesMultipleTypes ( top , name )
297307 )
298308}
299309
You can’t perform that action at this time.
0 commit comments