---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 11 Edition"
java_version: 11
chapter: "Chapter 4. The class File Format"
section: "4.3"
heading: "4.3. Descriptors"
parent: "Chapter 4. The class File Format"
source: https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.3
id: "4.3"
url: https://jvm.obfuscated.software/jvms/se11/4.3.html
raw: https://jvm.obfuscated.software/jvms/se11/4.3.md
---

# 4.3. Descriptors

A *descriptor* is a string representing the type of a field or method. Descriptors are represented in the `class` file format using modified UTF-8 strings ([§4.4.7](4.4.7.md)) and thus may be drawn, where not further constrained, from the entire Unicode codespace.

## 4.3.1. Grammar Notation

Descriptors are specified using a grammar. The grammar is a set of productions that describe how sequences of characters can form syntactically correct descriptors of various kinds. Terminal symbols of the grammar are shown in `fixed width` font. Nonterminal symbols are shown in *italic* type. The definition of a nonterminal is introduced by the name of the nonterminal being defined, followed by a colon. One or more alternative definitions for the nonterminal then follow on succeeding lines.

The syntax *{x}* on the right-hand side of a production denotes zero or more occurrences of *x*.

The phrase *(one of)* on the right-hand side of a production signifies that each of the terminal symbols on the following line or lines is an alternative definition.

## 4.3.2. Field Descriptors

A *field descriptor* represents the type of a class, instance, or local variable.

```
FieldDescriptor:
  FieldType

FieldType:
  BaseType
  ObjectType
  ArrayType

BaseType:
  (one of)
  B C D F I J S Z

ObjectType:
  L ClassName ;

ArrayType:
  [ ComponentType

ComponentType:
  FieldType
```

The characters of *BaseType*, the `L` and `;` of *ObjectType*, and the `[` of *ArrayType* are all ASCII characters.

*ClassName* represents a binary class or interface name encoded in internal form ([§4.2.1](4.2.1.md)).

The interpretation of field descriptors as types is shown in [Table 4.3-A](4.3.2.md).

A field descriptor representing an array type is valid only if it represents a type with 255 or fewer dimensions.

**Table 4.3-A. Interpretation of field descriptors**

| *FieldType* term | Type | Interpretation |
|---|---|---|
| `B` | `byte` | signed byte |
| `C` | `char` | Unicode character code point in the Basic Multilingual Plane, encoded with UTF-16 |
| `D` | `double` | double-precision floating-point value |
| `F` | `float` | single-precision floating-point value |
| `I` | `int` | integer |
| `J` | `long` | long integer |
| `L` *ClassName* `;` | `reference` | an instance of class *ClassName* |
| `S` | `short` | signed short |
| `Z` | `boolean` | `true` or `false` |
| `[` | `reference` | one array dimension |

The field descriptor of an instance variable of type `int` is simply `I`.

The field descriptor of an instance variable of type `Object` is `Ljava/lang/Object;`. Note that the internal form of the binary name for class `Object` is used.

The field descriptor of an instance variable of the multidimensional array type `double[][][]` is `[[[D`.

## 4.3.3. Method Descriptors

A *method descriptor* contains zero or more *parameter descriptors*, representing the types of parameters that the method takes, and a *return descriptor*, representing the type of the value (if any) that the method returns.

```
MethodDescriptor:
  ( {ParameterDescriptor} ) ReturnDescriptor

ParameterDescriptor:
  FieldType

ReturnDescriptor:
  FieldType
  VoidDescriptor

VoidDescriptor:
  V
```

The character `V` indicates that the method returns no value (its result is `void`).

The method descriptor for the method:

```
Object m(int i, double d, Thread t) {...}
```

is:

```
(IDLjava/lang/Thread;)Ljava/lang/Object;
```

Note that the internal forms of the binary names of `Thread` and `Object` are used.

A method descriptor is valid only if it represents method parameters with a total length of 255 or less, where that length includes the contribution for `this` in the case of instance or interface method invocations. The total length is calculated by summing the contributions of the individual parameters, where a parameter of type `long` or `double` contributes two units to the length and a parameter of any other type contributes one unit.

A method descriptor is the same whether the method it describes is a class method or an instance method. Although an instance method is passed `this`, a reference to the object on which the method is being invoked, in addition to its intended arguments, that fact is not reflected in the method descriptor. The reference to `this` is passed implicitly by the Java Virtual Machine instructions which invoke instance methods ([§2.6.1](2.6.1.md), [§4.11](4.11.md)).
