11

I see this in a stack trace:

myorg.vignettemodules.customregistration.NewsCategoryVAPDAO.getEmailContentByID(I)Lmyorg/pushemail/model/EmailContent;

What does the "(I)L" mean?

2
  • Java's name mangling is documented somewhere on Sun's site. Somebody should look it up and link to it from the accepted answer. Commented Dec 10, 2008 at 20:01
  • I've only ever seen this name mangling used with JNI; I got my information from journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/… Commented Dec 10, 2008 at 20:41

4 Answers 4

20

It's a form of name mangling used for disambiguating method overloads. The method name is appended by a series of characters describing the parameters and return type: the parameters appear sequentially inside parentheses, and the return type follows the closing parenthesis. The codes are as follows:

  • Z: boolean
  • B: byte
  • C: char
  • S: short
  • I: int
  • J: long
  • F: float
  • D: double
  • Lfully-qualified-class-name ; : fully qualified class
  • [ type : array of type
  • V: void

So, in your case, the (I)Lmyorg/pushemail/model/EmailContent; means the method takes one argument of type int and returns an object of type myorg.pushemail.model.EmailContent.

Sign up to request clarification or add additional context in comments.

Comments

16

It means the method takes an int, and returns myorg.pushemail.model.EmailContent

The string from "L" to ";" is one type descriptor, for the return type. The stuff inside parentheses are the method parameters (in this case, there's just one).

These type descriptors are defined as part of the Java Virtual Machine Specification, in section 4.3.2. Table 4.3-A shows all of the codes used. When a class is compiled, descriptors of this form are used to specify the signature of methods and the types of fields and variables.

In Java serialization, method descriptors are part of the information that is hashed to form the default serialVersionUID for a Serializable class.

In RMI, method descriptors are hashed, and the result is used to identify which method is being invoked in the remote interface.

Comments

0

It's a minor point but I don't think this is name mangling. Name mangling implies adding extra stuff to a name. ZBC etc is just how java encodes method signatures in class files. Instead of writing boolean, they put a Z. It saves space.

According to wikipedia (standard disclaimer applies), the only name mangling in java involves inner classes and JNI.

1 Comment

This should be a comment on AdamRosenfield's answer, not an answer by itself.
0

It says, that there is no method in class myorg.vignettemodules.customregistration.NewsCategoryVAPDAO called getEmailContentByID that accepts int arguments [denoted by (I)] and returns an object (announced by L) called myorg/pushemail/model/EmailContent (closed by ';').

The L and I character is used to signify a classname and integer in Java's internal class specification.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.