# Interface SourceFileAttribute

All Superinterfaces:
  `Attribute<SourceFileAttribute>, ClassElement, ClassFileElement`

public sealed interface SourceFileAttribute extends Attribute<SourceFileAttribute>, ClassElement
Models the `SourceFile` attribute (JVMS §4.7.10), which indicates the name of the source file from which this `class` file was compiled.

This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.

The attribute was introduced in the Java SE Platform version 5.0, major version 49.

See Java Virtual Machine Specification:
  4.7.10 The `SourceFile` Attribute
Since:
  24
See Also:
  - `Attributes.sourceFile()`

## Method Summary

Modifier and Type
Method
Description
`static SourceFileAttribute`
`of(Utf8Entry sourceFile)`
Returns a source file attribute.
`static SourceFileAttribute`
`of(String sourceFile)`
Returns a source file attribute.
`Utf8Entry`
`sourceFile()`
Returns the name of the source file from which this class was compiled.

### Methods declared in interface Attribute

`attributeMapper, attributeName`
Modifier and Type
Method
Description
`AttributeMapper<SourceFileAttribute>`
`attributeMapper()`
Returns the `AttributeMapper` associated with this attribute.
`Utf8Entry`
`attributeName()`
Returns the name of the attribute.

## Method Details

### sourceFile

Utf8Entry sourceFile()
Returns the name of the source file from which this class was compiled.

Returns:
  the name of the source file from which this class was compiled

### of

static SourceFileAttribute of(String sourceFile)
Returns a source file attribute.

Parameters:
  `sourceFile` - the source file name
Returns:
  a source file attribute

### of

static SourceFileAttribute of(Utf8Entry sourceFile)
Returns a source file attribute.

Parameters:
  `sourceFile` - the source file name
Returns:
  a source file attribute