---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 20 Edition"
java_version: 20
chapter: "Chapter 4. The class File Format"
section: "4.7.15"
heading: "4.7.15. The Deprecated Attribute"
parent: "4.7. Attributes"
source: https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.7.15
id: "4.7.15"
url: https://jvm.obfuscated.software/jvms/se20/4.7.15.html
raw: https://jvm.obfuscated.software/jvms/se20/4.7.15.md
---

# 4.7.15. The `Deprecated` Attribute

The `Deprecated` attribute is an optional fixed-length attribute in the `attributes` table of a `ClassFile`, `field_info`, or `method_info` structure ([§4.1](4.1.md), [§4.5](4.5.md), [§4.6](4.6.md)). A class, interface, method, or field may be marked using a `Deprecated` attribute to indicate that the class, interface, method, or field has been superseded.

A run-time interpreter or tool that reads the `class` file format, such as a compiler, can use this marking to advise the user that a superseded class, interface, method, or field is being referred to. The presence of a `Deprecated` attribute does not alter the semantics of a class or interface.

The `Deprecated` attribute has the following format:

```
Deprecated_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
}
```

The items of the `Deprecated_attribute` structure are as follows:

- **attribute_name_index**

  The value of the `attribute_name_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing the string "`Deprecated`".

- **attribute_length**

  The value of the `attribute_length` item must be zero.
