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

# 4.7.8. The `Synthetic` Attribute

The `Synthetic` attribute is a 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 member that does not appear in the source code must be marked using a `Synthetic` attribute, or else it must have its `ACC_SYNTHETIC` flag set. The only exceptions to this requirement are compiler-generated methods which are not considered implementation artifacts, namely the instance initialization method representing a default constructor of the Java programming language ([§2.9.1](2.9.1.md)), the class or interface initialization method ([§2.9.2](2.9.2.md)), and the `Enum.values()` and `Enum.valueOf()` methods.

The `Synthetic` attribute was introduced in JDK 1.1 to support nested classes and interfaces.

The `Synthetic` attribute has the following format:

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

The items of the `Synthetic_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 "`Synthetic`".

- **attribute_length**

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