first commit
This commit is contained in:
commit
063194f8be
349 changed files with 36508 additions and 0 deletions
45
jasmin/jasmin-2.4/src/jas/ExceptAttr.java
Normal file
45
jasmin/jasmin-2.4/src/jas/ExceptAttr.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* This attribute is associated with a method, and indicates
|
||||
* the set of exceptions (as classCP items) that can be thrown
|
||||
* by the method.
|
||||
*
|
||||
* @author $Author: jonmeyerny $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
|
||||
package jas;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class ExceptAttr
|
||||
{
|
||||
static final CP attr = new AsciiCP("Exceptions");
|
||||
|
||||
Vector cps;
|
||||
|
||||
public ExceptAttr() { cps = new Vector(); }
|
||||
/**
|
||||
* @param cp Exception class to be added to attribute. This is
|
||||
* typically a ClassCP
|
||||
*/
|
||||
public void addException(CP cp)
|
||||
{ cps.addElement(cp); }
|
||||
|
||||
void resolve(ClassEnv e)
|
||||
{
|
||||
e.addCPItem(attr);
|
||||
for (Enumeration en = cps.elements(); en.hasMoreElements();)
|
||||
{ e.addCPItem((CP)(en.nextElement())); }
|
||||
}
|
||||
|
||||
void write(ClassEnv e, DataOutputStream out)
|
||||
throws IOException, jasError
|
||||
{
|
||||
out.writeShort(e.getCPIndex(attr));
|
||||
out.writeInt(cps.size()*2 + 2);
|
||||
out.writeShort(cps.size());
|
||||
for (Enumeration en = cps.elements(); en.hasMoreElements();)
|
||||
{ out.writeShort(e.getCPIndex((CP)(en.nextElement()))); }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue