@@ -52,6 +52,8 @@ private predicate genericContainerType(RefType t, TypeVariable tv) {
52
52
et = t .( ContainerType ) .getElementType ( )
53
53
or
54
54
et = t .( IterableType ) .getElementType ( )
55
+ or
56
+ et = t .( Array ) .getElementType ( )
55
57
|
56
58
isEffectivelyUpperBound ( et , tv )
57
59
)
@@ -72,17 +74,25 @@ private predicate localTypeParameter(Callable callable, TypeVariable tv) {
72
74
callable .( GenericCallable ) .getATypeParameter ( ) = tv
73
75
}
74
76
77
+ /**
78
+ * Gets the access path postfix for `t`.
79
+ */
80
+ private string getAccessPath ( Type t ) {
81
+ if
82
+ t instanceof Array and
83
+ not Specific:: isPrimitiveTypeUsedForBulkData ( t .( Array ) .getElementType ( ) )
84
+ then result = ".ArrayElement"
85
+ else
86
+ if t instanceof ContainerType or t instanceof IterableType
87
+ then result = ".Element"
88
+ else result = ""
89
+ }
90
+
91
+ /**
92
+ * Gets the access path for parameter `p`.
93
+ */
75
94
private string parameterAccess ( Parameter p ) {
76
- exists ( Type t | t = p .getType ( ) |
77
- if
78
- t instanceof Array and
79
- not Specific:: isPrimitiveTypeUsedForBulkData ( p .getType ( ) .( Array ) .getElementType ( ) )
80
- then result = "Argument[" + p .getPosition ( ) + "].ArrayElement"
81
- else
82
- if t instanceof ContainerType or t instanceof IterableType
83
- then result = "Argument[" + p .getPosition ( ) + "].Element"
84
- else result = "Argument[" + p .getPosition ( ) + "]"
85
- )
95
+ result = "Argument[" + p .getPosition ( ) + "]" + getAccessPath ( p .getType ( ) )
86
96
}
87
97
88
98
/**
@@ -117,9 +127,10 @@ private string getSyntheticField(TypeVariable tv) {
117
127
private string implicit ( Callable callable , TypeVariable tv ) {
118
128
classTypeParameter ( callable , tv ) and
119
129
not callable .isStatic ( ) and
120
- exists ( string access |
121
- if genericContainerType ( callable .getDeclaringType ( ) , tv )
122
- then access = ".Element"
130
+ exists ( string access , Type decl |
131
+ decl = callable .getDeclaringType ( ) and
132
+ if genericContainerType ( decl , tv )
133
+ then access = getAccessPath ( decl )
123
134
else access = getSyntheticField ( tv )
124
135
|
125
136
result = Specific:: qualifierString ( ) + access
@@ -194,7 +205,7 @@ bindingset[callable]
194
205
private string getAccess ( Callable callable , Type return , TypeVariable tv ) {
195
206
return = tv and result = ""
196
207
or
197
- genericContainerType ( return , tv ) and result = ".Element"
208
+ genericContainerType ( return , tv ) and result = getAccessPath ( return )
198
209
or
199
210
not genericContainerType ( return , tv ) and
200
211
(
0 commit comments