chb0kotlin
06/04/2017, 7:20 PMclass Test(val thing:String, val other:Int)
public class Authority implements GrantedAuthority {
private User user;
private String role;
public Authority(User user, String role) {
this.user = user;
this.role = role;
}
}
test code:
public class Foo {
public static void main(String[] args) {
Arrays.stream(Test.class.getDeclaredConstructors()).map(Constructor::getParameters)
.flatMap(Arrays::stream).map(Parameter::getName).forEach(System.out::println);
Arrays.stream(Authority.class.getDeclaredConstructors()).map(Constructor::getParameters)
.flatMap(Arrays::stream).map(Parameter::getName).forEach(System.out::println);
}
}
output:
arg0
arg1
user
role
if you compile the java code with -parameters
you get the bottom 2 lines with java. Without it, you get the same as the 2 kotlin linesdiesieben07
06/04/2017, 7:27 PMKParameter::name
.chb0kotlin
06/05/2017, 1:35 AMdiesieben07
06/05/2017, 2:07 AM-java-parameters
.