@@ -128,6 +128,8 @@ private class IndirectType extends GeneratedType {
128128 this = getAContainedType ( t .getAGeneratedType ( ) ) .( RefType ) .getSourceDeclaration ( )
129129 )
130130 or
131+ exists ( GeneratedType t | this = t .( BoundedType ) .getATypeBound ( ) .getType ( ) )
132+ or
131133 exists ( GeneratedDeclaration decl |
132134 decl .( Member ) .getDeclaringType ( ) .getSourceDeclaration ( ) = this
133135 )
@@ -209,15 +211,34 @@ private string stubTypeName(Type t) {
209211 if t instanceof TypeVariable
210212 then result = t .getName ( )
211213 else
212- if t instanceof Array
213- then result = stubTypeName ( t . ( Array ) . getElementType ( ) ) + "[]"
214+ if t instanceof Wildcard
215+ then result = "?" + stubTypeBound ( t )
214216 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+ )
221242}
222243
223244private string stubQualifier ( RefType t ) {
@@ -232,33 +253,33 @@ private string stubGenericArguments(RefType t) {
232253 then
233254 result =
234255 "<" +
235- concat ( int n |
236- exists ( t .( GenericType ) .getTypeParameter ( n ) )
256+ concat ( int n , TypeVariable tv |
257+ tv = t .( GenericType ) .getTypeParameter ( n )
237258 |
238- t . ( GenericType ) . getTypeParameter ( n ) . getName ( ) , ", " order by n
259+ tv . getName ( ) + stubTypeBound ( tv ) , ", " order by n
239260 ) + ">"
240261 else
241262 if t instanceof ParameterizedType
242263 then
243264 result =
244265 "<" +
245- concat ( int n |
246- exists ( t .( ParameterizedType ) .getTypeArgument ( n ) )
266+ concat ( int n , Type tpar |
267+ tpar = t .( ParameterizedType ) .getTypeArgument ( n )
247268 |
248- stubTypeName ( t . ( ParameterizedType ) . getTypeArgument ( n ) ) , ", " order by n
269+ stubTypeName ( tpar ) , ", " order by n
249270 ) + ">"
250271 else result = ""
251272}
252273
253- private string stubGenericMethodParams ( Method m ) {
254- if m instanceof GenericMethod
274+ private string stubGenericCallableParams ( Callable m ) {
275+ if m instanceof GenericCallable
255276 then
256277 result =
257- " <" +
278+ "<" +
258279 concat ( int n , TypeVariable param |
259- param = m .( GenericMethod ) .getTypeParameter ( n )
280+ param = m .( GenericCallable ) .getTypeParameter ( n )
260281 |
261- param .getName ( ) , ", " order by n
282+ param .getName ( ) + stubTypeBound ( param ) , ", " order by n
262283 ) + "> "
263284 else result = ""
264285}
@@ -332,14 +353,14 @@ private string stubMember(Member m) {
332353 then result = ""
333354 else (
334355 result =
335- " " + stubModifiers ( m ) + stubGenericMethodParams ( m ) +
356+ " " + stubModifiers ( m ) + stubGenericCallableParams ( m ) +
336357 stubTypeName ( m .( Method ) .getReturnType ( ) ) + " " + m .getName ( ) + "(" + stubParameters ( m ) + ")"
337358 + stubImplementation ( m ) + "\n"
338359 or
339360 m instanceof Constructor and
340361 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"
343364 or
344365 result =
345366 " " + stubModifiers ( m ) + stubTypeName ( m .( Field ) .getType ( ) ) + " " + m .getName ( ) + " = " +
@@ -389,6 +410,8 @@ private RefType getAReferencedType(RefType t) {
389410 result = t1 .( ParameterizedType ) .getATypeArgument ( )
390411 or
391412 result = t1 .( Array ) .getElementType ( )
413+ or
414+ result = t1 .( BoundedType ) .getATypeBound ( ) .getType ( )
392415 )
393416}
394417
0 commit comments