40

I'm trying to track down a memory leak in a java process, using jmap and jhat. Every time I do this I see those weird notation for specific object types, like [S for string arrays and [C for Character arrays. I never remember what means what, and it's very hard to google this stuff.

(EDIT: to prove my point, it turns out that [S is array of short and [C is array of char.)

Anyone care to make a table listing all the different class names and what they mean? Or point me to such table?

Specifically I'd like to know what [Ljava.lang.Object; means.

trincot
  • 317,000
  • 35
  • 244
  • 286
itsadok
  • 28,822
  • 30
  • 126
  • 171
  • Array of string should be _[Ljava/lang/String;_. – Tom Hawtin - tackline Jul 06 '09 at 14:14
  • In my defense, googling led me to an article on java.sun.com which contains this line: "The String and Character array objects, [S and [C, are always going to be high on this list". Somewhat misleading. – itsadok Jul 06 '09 at 14:32
  • This site also has some good information: https://communities.ca.com/web/ca-wily-global-user-community/wiki/-/wiki/Main/JNI+Signatures/contactLink – masterxilo Jun 12 '14 at 12:01
  • This link is broken. I hate to post links, but I'll post the updated link for the previous comment - https://communities.ca.com/docs/DOC-99575135. – Mike Stoddart Jan 31 '19 at 19:31

4 Answers4

70

You'll find the complete list documented under Class.getName():

If this class object represents a reference type that is not an array type then the binary name of the class is returned, as specified by the Java™ Language Specification, Second Edition.

If this class object represents a primitive type or void, then the name returned is a String equal to the Java language keyword corresponding to the primitive type or void.

If this class object represents a class of arrays, then the internal form of the name consists of the name of the element type preceded by one or more '[' characters representing the depth of the array nesting. The encoding of element type names is as follows:

Element Type        Encoding
boolean             Z
byte                B
char                C
class or interface  Lclassname;
double              D
float               F
int                 I
long                J
short               S 
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
kdgregory
  • 38,754
  • 10
  • 77
  • 102
17

it is an array of objects as specified by JVM Specifications for internal representation of class names:

  • a single [ means an array of
  • L followed by a fully qualified class name (e.g. java/lang/Object) is the class name terminated by semicolon ;

so [Ljava.lang.object; means Object[]

dfa
  • 114,442
  • 31
  • 189
  • 228
  • Section 4.3.2 is probably a better reference. – Tom Hawtin - tackline Jul 06 '09 at 14:18
  • that link doesn't actually describe the conventions used by Class.getName() -- in fact, the internal naming representation is quite different – kdgregory Jul 06 '09 at 14:19
  • furthermore the internal naming is same of Class.getName(), just replace / with . – dfa Jul 06 '09 at 14:33
  • I saw this: `org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Lj ava/lang/Object;Ljava/lang/Throwable;)V` -- What does "IL" mean? The methods that closely match that signature are `log(Marker, String, int, String, Object[], Throwable)`, do primitives not get separated by semi-colon? – Neil Apr 27 '12 at 16:05
6

The rules are listed in the API doc of Class.getName().

[Ljava.lang.Object; would be an instance of Object[]. Note that multidimensional arrays are displayed with multiple opening braces.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
-3

Means Object[]

omerkudat
  • 9,371
  • 4
  • 33
  • 42