Methods
Methods are listed once per signature: the most specific override wins, bridges and synthetic methods are left out, and return types are resolved against the starting type.
Public in the hierarchy, or anything on the class
findMethod matches public methods like Class.getMethod, inherited ones included. findDeclaredMethod finds any method of the class itself, private ones included. Parameters are given as erased classes.
One entry per signature
overrides lists the methods of supertypes with the same name and parameter types. methods leaves every one of them out, so iterating methods never sees a signature twice.
annotations of a method includes the declared annotations of everything it overrides. An annotation on the trait's method is found on the implementation.
invoke
invoke makes the method accessible and calls it with the given arguments. Exceptions thrown by the method arrive wrapped in InvocationTargetException, as with plain reflection.
What methods a Scala class has
Accessors, setters and compiler-generated members are ordinary methods to the JVM and appear in methods.
- val name
- Method name().
- var name
- Methods name() and name_$eq(value).
- case class
- copy, productArity, productElement, equals, hashCode, toString and _1, _2 …
- default arguments
- Methods like greeting$default$1 for each default.