@@ -128,6 +128,8 @@ private class IndirectType extends GeneratedType {
128
128
this = getAContainedType ( t .getAGeneratedType ( ) ) .( RefType ) .getSourceDeclaration ( )
129
129
)
130
130
or
131
+ exists ( GeneratedType t | this = t .( BoundedType ) .getATypeBound ( ) .getType ( ) )
132
+ or
131
133
exists ( GeneratedDeclaration decl |
132
134
decl .( Member ) .getDeclaringType ( ) .getSourceDeclaration ( ) = this
133
135
)
@@ -209,15 +211,34 @@ private string stubTypeName(Type t) {
209
211
if t instanceof TypeVariable
210
212
then result = t .getName ( )
211
213
else
212
- if t instanceof Array
213
- then result = stubTypeName ( t . ( Array ) . getElementType ( ) ) + "[]"
214
+ if t instanceof Wildcard
215
+ then result = "?" + stubTypeBound ( t )
214
216
else
215
- if t instanceof RefType
216
- then
217
- result =
218
- stubQualifier ( t ) + t .( RefType ) .getSourceDeclaration ( ) .getName ( ) +
219
- stubGenericArguments ( t )
220
- else result = "<error>"
217
+ if t instanceof Array
218
+ then result = stubTypeName ( t .( Array ) .getElementType ( ) ) + "[]"
219
+ else
220
+ if t instanceof ClassOrInterface
221
+ then
222
+ result =
223
+ stubQualifier ( t ) + t .( RefType ) .getSourceDeclaration ( ) .getName ( ) +
224
+ stubGenericArguments ( t )
225
+ else result = "<error>"
226
+ }
227
+
228
+ language [ monotonicAggregates]
229
+ private string stubTypeBound ( BoundedType t ) {
230
+ if not exists ( t .getATypeBound ( ) )
231
+ then result = ""
232
+ else
233
+ exists ( string kw , string bounds | result = kw + bounds |
234
+ ( if t .( Wildcard ) .hasLowerBound ( ) then kw = " super " else kw = " extends " ) and
235
+ bounds =
236
+ concat ( TypeBound b |
237
+ b = t .getATypeBound ( )
238
+ |
239
+ stubTypeName ( b .getType ( ) ) , " & " order by b .getPosition ( )
240
+ )
241
+ )
221
242
}
222
243
223
244
private string stubQualifier ( RefType t ) {
@@ -232,33 +253,33 @@ private string stubGenericArguments(RefType t) {
232
253
then
233
254
result =
234
255
"<" +
235
- concat ( int n |
236
- exists ( t .( GenericType ) .getTypeParameter ( n ) )
256
+ concat ( int n , TypeVariable tv |
257
+ tv = t .( GenericType ) .getTypeParameter ( n )
237
258
|
238
- t . ( GenericType ) . getTypeParameter ( n ) . getName ( ) , ", " order by n
259
+ tv . getName ( ) + stubTypeBound ( tv ) , ", " order by n
239
260
) + ">"
240
261
else
241
262
if t instanceof ParameterizedType
242
263
then
243
264
result =
244
265
"<" +
245
- concat ( int n |
246
- exists ( t .( ParameterizedType ) .getTypeArgument ( n ) )
266
+ concat ( int n , Type tpar |
267
+ tpar = t .( ParameterizedType ) .getTypeArgument ( n )
247
268
|
248
- stubTypeName ( t . ( ParameterizedType ) . getTypeArgument ( n ) ) , ", " order by n
269
+ stubTypeName ( tpar ) , ", " order by n
249
270
) + ">"
250
271
else result = ""
251
272
}
252
273
253
- private string stubGenericMethodParams ( Method m ) {
254
- if m instanceof GenericMethod
274
+ private string stubGenericCallableParams ( Callable m ) {
275
+ if m instanceof GenericCallable
255
276
then
256
277
result =
257
- " <" +
278
+ "<" +
258
279
concat ( int n , TypeVariable param |
259
- param = m .( GenericMethod ) .getTypeParameter ( n )
280
+ param = m .( GenericCallable ) .getTypeParameter ( n )
260
281
|
261
- param .getName ( ) , ", " order by n
282
+ param .getName ( ) + stubTypeBound ( param ) , ", " order by n
262
283
) + "> "
263
284
else result = ""
264
285
}
@@ -332,14 +353,14 @@ private string stubMember(Member m) {
332
353
then result = ""
333
354
else (
334
355
result =
335
- " " + stubModifiers ( m ) + stubGenericMethodParams ( m ) +
356
+ " " + stubModifiers ( m ) + stubGenericCallableParams ( m ) +
336
357
stubTypeName ( m .( Method ) .getReturnType ( ) ) + " " + m .getName ( ) + "(" + stubParameters ( m ) + ")"
337
358
+ stubImplementation ( m ) + "\n"
338
359
or
339
360
m instanceof Constructor and
340
361
result =
341
- " " + stubModifiers ( m ) + m . getName ( ) + "(" + stubParameters ( m ) + ") " +
342
- stubImplementation ( m ) + "\n"
362
+ " " + stubModifiers ( m ) + stubGenericCallableParams ( m ) + m . getName ( ) + "( " +
363
+ stubParameters ( m ) + ")" + stubImplementation ( m ) + "\n"
343
364
or
344
365
result =
345
366
" " + stubModifiers ( m ) + stubTypeName ( m .( Field ) .getType ( ) ) + " " + m .getName ( ) + " = " +
@@ -389,6 +410,8 @@ private RefType getAReferencedType(RefType t) {
389
410
result = t1 .( ParameterizedType ) .getATypeArgument ( )
390
411
or
391
412
result = t1 .( Array ) .getElementType ( )
413
+ or
414
+ result = t1 .( BoundedType ) .getATypeBound ( ) .getType ( )
392
415
)
393
416
}
394
417
0 commit comments