java.lang.Object
org.fife.rsta.ac.java.classreader.attributes.AttributeInfo
org.fife.rsta.ac.java.classreader.attributes.SourceFile

public class SourceFile extends AttributeInfo
The SourceFile attribute, an optional fixed-length attribute in the attributes table of a ClassFile. There can be no more than one SourceFile attribute for a given ClassFile.
Version:
1.0
  • Field Details

    • sourceFileIndex

      private int sourceFileIndex
      Index into the constant pool of a ConstantUtf8Info structure representing the name of the source file from which this class file was compiled.
  • Constructor Details

    • SourceFile

      public SourceFile(ClassFile cf, int sourceFileIndex)
      Constructor.
      Parameters:
      cf - The class file.
      sourceFileIndex - Index into the constant pool of a ConstantUtf8Info structure representing the source file name.
  • Method Details

    • getSourceFileName

      public String getSourceFileName()
      Returns the name of the source file that was compiled to create this class file.
      Returns:
      The name of the source file.
    • toString

      public String toString()
      Returns a string representation of this attribute. Useful for debugging.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this attribute.