Search code examples
javafunctionmethodssymbol-tablessymbol-table

What is the internal identification of a Java method?


As we know, in Java, method name is not sufficient to distinguish different methods.

I think (may be wrong), to distinguish a method, it needs the following info:

(className, methodName, methodParameters)

Further,

  • how to identify a method more efficiently internally?
  • I heard of "method id". Does it mean there is a mapping between the above triple and an integer, so JVM use only method id after parsing?
  • If so, is it resided in symbol table?

Thanks!


Solution

  • It's a CONSTANT_NameAndType_info Structure pointing at a method descriptor.

    It pretty much consists of the method name, the parameter types, and (somewhat surprisingly) the return type.