All Downloads are FREE. Search and download functionalities are using the official Maven repository.

opu.lljvm-python.0.2.0-EXPERIMENTAL.source-code.SourceAttr Maven / Gradle / Ivy

The newest version!
/**
 * This attribute is used to embed Source file information into
 * a class file.
 * @author $Author: jonmeyerny $
 * @version $Revision: 1.1 $
 */

package jas;

import java.io.*;

public class SourceAttr
{
  static final CP attr = new AsciiCP("SourceFile");

  CP name;

  /**
   * Create a source file attribute.
   * @param name Name of the source file
   * @see ClassEnv#setSource
   */

  public SourceAttr(String name)
  { this.name = new AsciiCP(name); }

  /**
   * Create a source file attribute, with more control over attribute name
   * @param name CP to be associated as the name of the source file
   * @see ClassEnv#setSource
   */
  public SourceAttr(CP name)
  { this.name = name; }

  void resolve(ClassEnv e)
  { e.addCPItem(attr); e.addCPItem(name); }

  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(2);
    out.writeShort(e.getCPIndex(name));
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy