Fork me on GitHub

At run time we can do reflection on a Java class / interface to get a list of all of its methods, and the signature of the method, e.g. return type, number of parameters and their types. I know that a method in a class is considered to implement a method signature in an interface if the return type, number of parameters, and types of all parameters are equal, but I believe that there are other cases where the return type and/or parameter types are not equal, but "compatible", that the class's method is also considered to implement the method of the interface. Does anyone have precise rules, and/or some JVM library function, that determines whether a class's method implements an interface's method signature?

Alex Miller (Clojure team)15:12:00

this is all in the specs

Alex Miller (Clojure team)15:12:59

I assume you're talking about subtypes and covariant return types etc?

Alex Miller (Clojure team)15:12:27

if so, see the java language spec