<@U5FCGNB1N> you don't understand the question. Le...
# announcements
c
@brumla you don't understand the question. Let me give sample source:
Copy code
class Test(val thing:String, val other:Int)
Copy code
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:
Copy 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 lines
d
chb0kotlin: Kotlin does not support the parameter name format that Java 8 uses yet. You can however use the Kotlin reflection library to get them using
KParameter::name
.
c
I need this reflection to work from inside of Java. Where can I submit an idea/request for this feature?
d
Apparently it was implemented already, it is just off by default. The compiler argument is
-java-parameters
.