Deprecated attribute

Marks a deprecated declaration.

Appears on
class, field, method
Since
class file 45.0 (Java 1.1)
javac writes it
for @Deprecated declarations
Needed by the JVM
no: it is for the class libraries (reflection), compilers or tools

Layout

Only the common header: the attribute has no contents of its own.

TypeFieldWhat it holds
u2attribute_name_indexa Utf8: "Deprecated"
u4attribute_lengthbytes after this field

What it is for

Marks a deprecated declaration. It has no contents. javac writes it alongside the @Deprecated annotation, which is what tools now use.

How common it is

JDK 25.0.5's java.base has 315 Deprecated attributes, in 163 of its 7,391 classes (204 on methods, 48 on classs, 63 on fields).

A real one, byte by byte

From Annotations.class (compiled by javac 25), on method old:

OffsetBytesFieldValue
13646 bytesDeprecated
136400 2dattribute_name_index#45
136600 00 00 00attribute_length0

Open in the viewer

Specification: JVMS §4.7, The Deprecated Attribute (Java SE 25).