|
To access instance fields and call methods that are defined in the Java programming language, you need to learn the rules for "mangling" the names of data types and method signatures. (A method signature describes the parameters and return type of the method.) Here is the encoding scheme:
Note that the semicolon at the end of the L expression is the terminator of the type expression, not a separator between parameters. For example, the constructor Employee(java.lang.String, double, java.util.Date) has a signature "(Ljava/lang/String;DLjava/util/Date;)V" Note that there is no separator between the D and Ljava/util/Date;. Also note that in this encoding scheme, you must use / instead of . to separate the package and class names. To describe an array type, use a [. For example, an array of strings is [Ljava/lang/String; A float[][] is mangled into [[F For the complete signature of a method, you list the parameter types inside a pair of parentheses and then list the return type. For example, a method receiving two integers and returning an integer is encoded as (II)I The print method that we used in the preceding example has a mangled signature of (Ljava/lang/String;)V That is, the method receives a string and returns void. TIP
NOTE
|
|