File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
java/ql/consistency-queries Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,22 @@ Type getATypeUsedInClass(RefType type) {
3030 result = getAMentionedType ( getATypeUsedInClass ( type ) )
3131}
3232
33- TypeVariable getATypeVariableInScope ( RefType type ) {
34- result = type .getACallable ( ) .( GenericCallable ) .getATypeParameter ( )
35- or
36- result = type .( GenericType ) .getATypeParameter ( )
37- or
38- result = getAMentionedType ( type .( InstantiatedType ) .getATypeArgument ( ) )
33+ Element getEnclosingElementStar ( RefType e ) {
34+ result = e
3935 or
40- result = getATypeVariableInScope ( type .getEnclosingType ( ) )
36+ result .contains ( e )
37+ }
38+
39+ TypeVariable getATypeVariableInScope ( RefType type ) {
40+ exists ( Element e | e = getEnclosingElementStar ( type ) |
41+ result = e .( RefType ) .getACallable ( ) .( GenericCallable ) .getATypeParameter ( )
42+ or
43+ result = e .( GenericType ) .getATypeParameter ( )
44+ or
45+ result = e .( GenericCallable ) .getATypeParameter ( )
46+ or
47+ result = getAMentionedType ( e .( InstantiatedType ) .getATypeArgument ( ) )
48+ )
4149}
4250
4351from ClassOrInterface typeUser , TypeVariable outOfScope
You can’t perform that action at this time.
0 commit comments