Files
codeql/java/ql/test/kotlin/library-tests/jvmoverloads_generics/test.ql
Chris Smowton d3d3ce843a Kotlin: Implement JvmOverloads annotation
This generates functions that omit parameters with default values, rightmost first, such that Java can achieve a similar experience to Kotlin (which represents calls internally as if the default was supplied explicitly, and/or uses a $default method that supplies the needed arguments).

A complication: combining JvmOverloads with JvmStatic means that both the companion object and the surrounding class get overloads.
2022-10-03 15:28:55 +01:00

17 lines
515 B
Plaintext

import java
from Method m, string kind, Type t
where
m.fromSource() and
(
kind = "param" and t = m.getAParamType()
or
kind = "return" and t = m.getReturnType()
)
// 't.(ParameterizedType).getATypeArgument().(Wildcard).getUpperBound().getType()' is pulling the 'T' out of 'List<? extends T>'
select m, m.getSignature(), kind, t.toString(),
[t, t.(ParameterizedType).getATypeArgument().(Wildcard).getUpperBound().getType()]
.(TypeVariable)
.getGenericCallable()
.getSignature()