Java debugging techniques - nimrody/knowledgebase GitHub Wiki

  • Use jstack to dump all threads call-stack. Set thread name to show what the thread is currently doing ("processing XYZZ; entering UVW..."):

    Thread.currentThread().setName(Context + TID + Params + current Time,..);
    
  • Compiled type signature

    It's always a set of parentheses enclosing type signifiers for the arguments, one after the other with no commas or anything, followed by a type signifier for the return value after the closing paren. It's pretty straightforward.

    There's a table of type signatures on this page:

    Signature	 Java Type
    Z	 boolean
    B	 byte
    C	 char
    S	 short
    I	 int
    J	 long
    F	 float
    D	 double
    V	 void
    L fully-qualified-class ;	 fully-qualified-class
    [ type  type[]
    

    Those last two mean that to name a class, you say, for example, Ljava/lang/Object;, and to name an array of (for example) int, you say [I, and an array of array of int is [[I.

    If you wanted to literally compute the signature in Java code based on reflection, it'd be simple enough; just use the table above with rules for handling objects and arrays.