Skip to content

Instantly share code, notes, and snippets.

@dfreudenberger
Created February 3, 2019 19:42
Show Gist options
  • Save dfreudenberger/d9f7e6aa7031aa106a14692223c3d1b8 to your computer and use it in GitHub Desktop.
Save dfreudenberger/d9f7e6aa7031aa106a14692223c3d1b8 to your computer and use it in GitHub Desktop.
// java
void consume(List<SomeClass> values)
{
}
// kotlin
fun consume(values : List<SomeClass>)
{
}
// reflection stuff
var param = class.getMethods()[0].getParameters()[0];
var type = ((ParameterizedType) param.getParameterizedType()).getActualTypeArguments()[0];
java: type.getTypeName() returns "SomeClass"
kotlin: type.getTypeName() returns "? extends SomeClass"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment