Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetStaticMethodId method signature for public static MyClass myMethod()

What is the method signature (for use with GetStaticMethodId) for this method:-

public static MyView newMyView() {
    return new MyView(RhodesService.getInstance().getContext(), null);
}

Is it "()Lcom/nativestuff/MyView;"? (if the package is com.nativestuff?)

like image 335
user433579 Avatar asked Nov 18 '12 16:11

user433579


2 Answers

Yes ()Lcom/nativestuff/MyView; is correct. In general:

  • B = byte
  • C = char
  • D = double
  • F = float
  • I = int
  • J = long
  • S = short
  • V = void
  • Z = boolean
  • Lfully-qualified-class = fully qualified class
  • [type = array of type
  • (argument types)return type = method type. If no arguments, use empty argument types: (). If return type is void (or constructor) use (argument types)V.
like image 111
arshajii Avatar answered Oct 14 '22 21:10

arshajii


()Lcom/nativestuff/MyView is correct.

You can also find the signature through

javap -s -classpath bin/classes com.nativestuff.MyView
like image 36
Wen Hsiao Avatar answered Oct 14 '22 23:10

Wen Hsiao