|
|
|
|
|
by masklinn
3376 days ago
|
|
According to the link Java/Javac does not support the feature. The JVM does, `bar(foo: List<String>): String` can be compiled to `bar(Ljava/util/List;)Ljava/lang/String;` and `bar(foo: List<Int>): Int` to `bar(Ljava/util/list;)Ljava/lang/Integer;` or somesuch, there is no ambiguity at the bytecode level. In fact, the documentation for Class#getMethod specifically outlines this issue[0]: > Note that there may be more than one matching method in a class because while the Java language forbids a class to declare multiple methods with the same signature but different return types, the Java virtual machine does not. [0] http://docs.oracle.com/javase/8/docs/api/java/lang/Class.htm... |
|
But you are actually right. It looks that JVM bytecode includes full function signature in function invocation: https://www.ibm.com/developerworks/library/it-haggar_bytecod... (if I'm reading examples correctly).