Package serp.bytecode

Class SourceFile

  • All Implemented Interfaces:
    BCEntity, VisitAcceptor

    public class SourceFile
    extends Attribute
    Attribute naming the source file for this class.
    Author:
    Abe White
    • Method Detail

      • getFileIndex

        public int getFileIndex()
        Return the index into the class ConstantPool of the UTF8Entry naming the source file for this class, or 0 if not set.
      • setFileIndex

        public void setFileIndex​(int sourceFileIndex)
        Set the index into the class ConstantPool of the UTF8Entry naming the source file for this class.
      • getFileName

        public java.lang.String getFileName()
        Return the name of the source file, or null if not set.
      • getFile

        public java.io.File getFile​(java.io.File dir)
        Return the file object for the source file, or null if not set.
        Parameters:
        dir - the directory of the file, or null
      • setFile

        public void setFile​(java.lang.String name)
        Set the name of the source file. The name should be the file name only; it should not include the path to the file.
      • setFile

        public void setFile​(java.io.File file)
        Set the source file. Note that only the file name is recorded; the path to the file is discarded.
      • setFromClassName

        public void setFromClassName()
        Set the file name from the current class name plus the .java extension.
      • acceptVisit

        public void acceptVisit​(BCVisitor visit)
        Description copied from interface: VisitAcceptor
        Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.