I created a constructor with Javassist which has no real method
CtConstructor c = CtNewConstructor.make ( argTypes, null, newClass );
When I'm trying to put out the signature of this class
c.getSignature();
I get
public Echo ()V
I'm confused what "V" means? I expected either public Echo (); or something similar...
E - Element (used extensively by the Java Collections Framework) K - Key. N - Number. T - Type. V - Value.
class Signature { } A signature is a static description of the parameter list of a code object. That is, it describes what and how many arguments you need to pass to the code or function in order to call it. Passing arguments to a signature binds the arguments, contained in a Capture, to the signature.
The method signature in java is defined as the structure of the method that is designed by the programmer. The method signature is the combination of the method name and the parameter list. The method signature depicts the behavior of the method i.e types of values of the method, return type of the method, etc.
Constructor syntax A constructor is a method whose name is the same as the name of its type. Its method signature includes only an optional access modifier, the method name and its parameter list; it does not include a return type. The following example shows the constructor for a class named Person .
The JVM uses a compact way of storing method signatures, of which constructors are considered a special case.
For your example:
()
indicates a method taking no argumentsV
indicates that it returns nothingThe other parts of the scheme are:
B
- byteC
- charD
- doubleF
- floatI
- intJ
- longS
- shortV
- voidZ
- boolean[
- array of the thing following the bracketL
[class name] ;
- instance of this class, with dots becoming slashes(
[args] )
[return type] - method signatureFor example:
public int foo(String bar, long[][] baz)
would become
(Ljava/lang/String;[[J)I
See the spec at Sun^H^H^HOracle's web site
"V" determines the result type "void"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With