Search code examples
javaterminologysignaturedescriptor

What is the difference between "descriptor" and "signature"?


I am now using ASM (Java bytecode instrumentation library). To retrieve the signature of given method, there is a field which is named "desc". I guess this is an abbreviation of "descriptor", but why isn't it named as "signature"? Is there any difference between "descriptor" and "signature"?


Solution

  • Looking at the JVM spec section 4.3.3, for one thing the descriptor contains the return type - whereas that isn't part of a the signature of a method.

    A method descriptor represents the parameters that the method takes and the value that it returns

    but...

    Two methods have the same signature if they have the same name and argument types

    (Given this, it's also not clear that the descriptor contains the name of the method...)