jasmin-p2.5

16:37:01.088 INFO  jd.cli.Main - Decompiling jasmin-p2.5.jar
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class Annotation
  extends CP
{
  private Vector fields;
  private AsciiCP type;
  private Annotation parent;
  private AnnotationElement field;
  private boolean is_default;
  
  public static final void ParserError()
    throws jasError
  {
    throw new jasError("internal logic error in annotation parsing");
  }
  
  private Annotation(Annotation parent, AsciiCP type)
  {
    this.type = type;
    this.parent = parent;
    field = null;
    fields = new Vector();
  }
  
  public Annotation(String type)
  {
    this(null, new AsciiCP(type));
  }
  
  public Annotation()
  {
    this(null, null);
  }
  
  public Annotation nestAnnotation()
    throws jasError
  {
    if (field == null) {
      ParserError();
    }
    Annotation tmp = new Annotation(this, field.nestType());
    field.addValue(tmp);
    return tmp;
  }
  
  public Annotation endAnnotation()
    throws jasError
  {
    if (field != null)
    {
      field.done();
      field = null;
    }
    return parent;
  }
  
  public void addField(String name, String type, String add)
    throws jasError
  {
    if ((this.type == null) && (fields.size() != 0)) {
      ParserError();
    }
    if (field != null)
    {
      field.done();
      field = null;
    }
    if ((name == null ? 1 : 0) != (this.type == null ? 1 : 0)) {
      ParserError();
    }
    field = new AnnotationElement(name, type, add);
    fields.add(field);
  }
  
  public void addValue(Object value)
    throws jasError
  {
    if (field == null) {
      ParserError();
    }
    field.addValue(value);
  }
  
  void resolve(ClassEnv e)
  {
    if (type != null) {
      e.addCPItem(type);
    }
    for (Enumeration en = fields.elements(); en.hasMoreElements();) {
      ((AnnotationElement)en.nextElement()).resolve(e);
    }
  }
  
  int size()
    throws jasError
  {
    if (field != null) {
      ParserError();
    }
    int len = 4;
    if (type == null)
    {
      if (fields.size() != 1) {
        ParserError();
      }
      len = 0;
    }
    for (Enumeration en = fields.elements(); en.hasMoreElements();) {
      len += ((AnnotationElement)en.nextElement()).size();
    }
    return len;
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    if (field != null) {
      ParserError();
    }
    if (type != null)
    {
      out.writeShort(e.getCPIndex(type));
      out.writeShort((short)fields.size());
    }
    else if (fields.size() != 1)
    {
      ParserError();
    }
    for (Enumeration en = fields.elements(); en.hasMoreElements();) {
      ((AnnotationElement)en.nextElement()).write(e, out);
    }
  }
}

/* Location:
 * Qualified Name:     jas.Annotation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class AnnotationAttr
{
  CP attr;
  Vector anns;
  
  public AnnotationAttr(boolean visible)
  {
    attr = new AsciiCP(visible ? "RuntimeVisibleAnnotations" : "RuntimeInvisibleAnnotations");
    
    anns = new Vector();
  }
  
  public void add(Annotation annotation)
  {
    anns.add(annotation);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    for (Enumeration en = anns.elements(); en.hasMoreElements();) {
      ((Annotation)en.nextElement()).resolve(e);
    }
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    int len = 2;
    for (Enumeration en = anns.elements(); en.hasMoreElements();) {
      len += ((Annotation)en.nextElement()).size();
    }
    out.writeInt(len);
    out.writeShort((short)anns.size());
    for (Enumeration en = anns.elements(); en.hasMoreElements();) {
      ((Annotation)en.nextElement()).write(e, out);
    }
  }
}

/* Location:
 * Qualified Name:     jas.AnnotationAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class AnnotationElement
{
  private boolean array;
  private char sign;
  private CP name;
  private CP exttype;
  private Vector values;
  private static final char type_int = 'I';
  private static final char type_byte = 'B';
  private static final char type_char = 'C';
  private static final char type_short = 'S';
  private static final char type_bool = 'Z';
  private static final char type_float = 'F';
  private static final char type_double = 'D';
  private static final char type_long = 'J';
  private static final char type_array = '[';
  private static final char type_string = 's';
  private static final char type_class = 'c';
  private static final char type_enum = 'e';
  private static final char type_annot = '@';
  
  private static void badsignature()
    throws jasError
  {
    throw new jasError("invalid type signature for annotation field");
  }
  
  public AnnotationElement(String name, String type, String exttype)
    throws jasError
  {
    this.name = null;
    if (name != null) {
      this.name = new AsciiCP(name);
    }
    values = new Vector();
    
    array = false;
    sign = type.charAt(0);
    if (sign != '[')
    {
      if (type.length() != 1) {
        badsignature();
      }
    }
    else
    {
      array = true;
      if (type.length() != 2) {
        badsignature();
      }
      sign = type.charAt(1);
    }
    switch (sign)
    {
    default: 
      badsignature();
    case '@': 
    case 'e': 
      if (exttype == null) {
        badsignature();
      }
      this.exttype = new AsciiCP(exttype);
      break;
    case 'B': 
    case 'C': 
    case 'D': 
    case 'F': 
    case 'I': 
    case 'J': 
    case 'S': 
    case 'Z': 
    case 'c': 
    case 's': 
      if (exttype != null) {
        badsignature();
      }
      this.exttype = null;
    }
  }
  
  void addValue(Object value)
    throws jasError
  {
    if (value == null) {
      Annotation.ParserError();
    }
    if ((!array) && (values.size() != 0)) {
      throw new jasError("too many values for nonarray annotation field type");
    }
    CP cp = null;
    switch (sign)
    {
    case 'B': 
    case 'C': 
    case 'I': 
    case 'S': 
    case 'Z': 
      if ((value instanceof Integer))
      {
        int val = ((Integer)value).intValue();
        boolean badval = false;
        switch (sign)
        {
        case 'Z': 
          if ((val < 0) || (val > 1)) {
            badval = true;
          }
          break;
        case 'C': 
          if ((val < 0) || (val > 65535)) {
            badval = true;
          }
          break;
        case 'B': 
          if ((val < -128) || (val > 127)) {
            badval = true;
          }
        case 'S': 
          if ((val < 32768) || (val > 32767)) {
            badval = true;
          }
          break;
        }
        if (badval) {
          throw new jasError("annotation field value exceed range of type", true);
        }
        cp = new IntegerCP(val);
      }
      break;
    case 'F': 
      if ((value instanceof Float)) {
        cp = new FloatCP(((Float)value).floatValue());
      }
      break;
    case 'D': 
      if ((value instanceof Double)) {
        cp = new DoubleCP(((Double)value).doubleValue());
      } else if ((value instanceof Float)) {
        cp = new DoubleCP(((Float)value).floatValue());
      }
      break;
    case 'J': 
      if ((value instanceof Long)) {
        cp = new LongCP(((Long)value).longValue());
      } else if ((value instanceof Integer)) {
        cp = new LongCP(((Integer)value).intValue());
      }
      break;
    case 'c': 
    case 'e': 
    case 's': 
      if ((value instanceof String)) {
        cp = new AsciiCP((String)value);
      }
      break;
    case '@': 
      if ((value instanceof Annotation)) {
        cp = (Annotation)value;
      }
      break;
    }
    if (cp == null) {
      throw new jasError("incompatible value for annotation field type");
    }
    values.add(cp);
  }
  
  public AsciiCP nestType()
    throws jasError
  {
    if (sign != '@') {
      Annotation.ParserError();
    }
    return (AsciiCP)exttype;
  }
  
  public void done()
    throws jasError
  {
    switch (values.size())
    {
    case 1: 
      return;
    default: 
      if (array) {
        return;
      }
      break;
    }
    Annotation.ParserError();
  }
  
  void resolve(ClassEnv e)
  {
    if (name != null) {
      e.addCPItem(name);
    }
    if (sign == 'e') {
      e.addCPItem(exttype);
    }
    for (Enumeration en = values.elements(); en.hasMoreElements();)
    {
      CP cp = (CP)en.nextElement();
      if (sign != '@') {
        e.addCPItem(cp);
      } else {
        cp.resolve(e);
      }
    }
  }
  
  int size()
    throws jasError
  {
    done();
    int len;
    Enumeration en;
    int len;
    if (sign == '@')
    {
      len = values.size();
      for (en = values.elements(); en.hasMoreElements();) {
        len += ((Annotation)en.nextElement()).size();
      }
    }
    else
    {
      len = 3;
      if (sign == 'e') {
        len += 2;
      }
      len *= values.size();
    }
    if (array) {
      len += 3;
    }
    if (name != null) {
      len += 2;
    }
    return len;
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    done();
    if (name != null) {
      out.writeShort(e.getCPIndex(name));
    }
    if (array)
    {
      out.writeByte(91);
      out.writeShort((short)values.size());
    }
    short id = 0;
    if (sign == 'e') {
      id = e.getCPIndex(exttype);
    }
    for (Enumeration en = values.elements(); en.hasMoreElements();)
    {
      out.writeByte(sign);
      CP cp = (CP)en.nextElement();
      switch (sign)
      {
      case '@': 
        ((Annotation)cp).write(e, out);
        break;
      case 'e': 
        out.writeShort(id);
      default: 
        out.writeShort(e.getCPIndex(cp));
      }
    }
  }
}

/* Location:
 * Qualified Name:     jas.AnnotationElement
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class AnnotDefAttr
{
  static final CP attr = new AsciiCP("AnnotationDefault");
  Annotation ann = new Annotation();
  
  public Annotation get()
  {
    return ann;
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    ann.resolve(e);
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(ann.size());
    ann.write(e, out);
  }
}

/* Location:
 * Qualified Name:     jas.AnnotDefAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class AnnotParamAttr
{
  CP attr;
  Vector anns;
  
  public AnnotParamAttr(boolean visible)
  {
    attr = new AsciiCP(visible ? "RuntimeVisibleParameterAnnotations" : "RuntimeInvisibleParameterAnnotations");
    
    anns = new Vector();
  }
  
  public void add(Annotation annotation, int paramnum)
  {
    Vector ap = null;
    int top = anns.size();
    if (paramnum < top) {
      ap = (Vector)anns.elementAt(paramnum);
    }
    if (ap == null)
    {
      if (paramnum >= top) {
        anns.setSize(paramnum + 1);
      }
      anns.set(paramnum, ap = new Vector());
    }
    ap.add(annotation);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    int i = 0;
    Enumeration en;
    for (int top = anns.size(); i < top; i++)
    {
      Vector ap = (Vector)anns.elementAt(i);
      if (ap != null) {
        for (en = ap.elements(); en.hasMoreElements();) {
          ((Annotation)en.nextElement()).resolve(e);
        }
      }
    }
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    int top = anns.size();int len = 1 + 2 * top;
    Enumeration en;
    for (int i = 0; i < top; i++)
    {
      Vector ap = (Vector)anns.elementAt(i);
      if (ap != null) {
        for (en = ap.elements(); en.hasMoreElements();) {
          len += ((Annotation)en.nextElement()).size();
        }
      }
    }
    out.writeInt(len);
    out.writeByte((byte)top);
    Enumeration en;
    for (int i = 0; i < top; i++)
    {
      Vector ap = (Vector)anns.elementAt(i);
      if (ap == null)
      {
        out.writeShort(0);
      }
      else
      {
        out.writeShort((short)ap.size());
        for (en = ap.elements(); en.hasMoreElements();) {
          ((Annotation)en.nextElement()).write(e, out);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     jas.AnnotParamAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class AsciiCP
  extends CP
  implements RuntimeConstants
{
  public AsciiCP(String s)
  {
    uniq = s.intern();
  }
  
  void resolve(ClassEnv e) {}
  
  public String toString()
  {
    return "AsciiCP: " + uniq;
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException
  {
    out.writeByte(1);
    out.writeUTF(uniq);
  }
}

/* Location:
 * Qualified Name:     jas.AsciiCP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

class ByteOperand
  extends InsnOperand
{
  int val;
  
  ByteOperand(int n)
  {
    val = n;
  }
  
  int size(ClassEnv ce, CodeAttr code)
  {
    return 1;
  }
  
  void resolve(ClassEnv e) {}
  
  void write(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException
  {
    out.writeByte((byte)val);
  }
}

/* Location:
 * Qualified Name:     jas.ByteOperand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class CatchEntry
{
  Label start_pc;
  Label end_pc;
  Label handler_pc;
  int start_off;
  int end_off;
  int handler_off;
  CP catch_cpe;
  
  public CatchEntry(Label start, Label end, Label handler, CP cat)
  {
    start_pc = start;
    end_pc = end;
    handler_pc = handler;
    catch_cpe = cat;
  }
  
  public CatchEntry(int start, int end, int handler, CP cat)
  {
    start_off = start;
    end_off = end;
    handler_off = handler;
    catch_cpe = cat;
  }
  
  void resolve(ClassEnv e)
  {
    if (catch_cpe != null) {
      e.addCPItem(catch_cpe);
    }
  }
  
  void write(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException, jasError
  {
    if ((start_pc != null) && (end_pc != null) && (handler_pc != null))
    {
      start_pc.writeOffset(ce, null, out);
      end_pc.writeOffset(ce, null, out);
      handler_pc.writeOffset(ce, null, out);
    }
    else
    {
      out.writeShort(start_off);
      out.writeShort(end_off);
      out.writeShort(handler_off);
    }
    if (catch_cpe != null) {
      out.writeShort(e.getCPIndex(catch_cpe));
    } else {
      out.writeShort(0);
    }
  }
}

/* Location:
 * Qualified Name:     jas.CatchEntry
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class Catchtable
{
  Vector entries = new Vector();
  
  public void addEntry(CatchEntry entry)
  {
    entries.addElement(entry);
  }
  
  public void addEntry(Label start, Label end, Label handler, CP cat)
  {
    addEntry(new CatchEntry(start, end, handler, cat));
  }
  
  public void addEntry(int start, int end, int handler, CP cat)
  {
    addEntry(new CatchEntry(start, end, handler, cat));
  }
  
  void resolve(ClassEnv e)
  {
    for (Enumeration en = entries.elements(); en.hasMoreElements();)
    {
      CatchEntry ce = (CatchEntry)en.nextElement();
      ce.resolve(e);
    }
  }
  
  int size()
  {
    return 8 * entries.size();
  }
  
  void write(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(entries.size());
    for (Enumeration en = entries.elements(); en.hasMoreElements();)
    {
      CatchEntry entry = (CatchEntry)en.nextElement();
      entry.write(e, ce, out);
    }
  }
}

/* Location:
 * Qualified Name:     jas.Catchtable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class ClassCP
  extends CP
  implements RuntimeConstants
{
  AsciiCP name;
  
  public ClassCP(String name)
  {
    uniq = ("CLASS: #$%^#$" + name).intern();
    this.name = new AsciiCP(name);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(name);
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeByte(7);
    out.writeShort(e.getCPIndex(name));
  }
}

/* Location:
 * Qualified Name:     jas.ClassCP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class ClassEnv
  implements RuntimeConstants
{
  int magic;
  short version_lo;
  short version_hi;
  CP this_class;
  CP super_class;
  short class_access;
  Hashtable cpe;
  Hashtable cpe_index;
  Vector interfaces;
  Vector vars;
  Vector methods;
  SourceAttr source;
  SignatureAttr signature;
  SourceDebugExtensionAttr debug;
  EnclosingMethodAttr enclosing;
  DeprecatedAttr depr;
  InnerClassesAttr innerclasses;
  AnnotationAttr annVis;
  AnnotationAttr annInvis;
  Vector generic;
  
  public ClassEnv()
  {
    magic = -889275714;
    version_lo = 0;
    version_hi = 49;
    
    cpe = new Hashtable();
    cpe_index = null;
    interfaces = new Vector();
    vars = new Vector();
    methods = new Vector();
    annVis = (annInvis = null);
    generic = new Vector();
  }
  
  public void setClass(CP name)
  {
    this_class = name;addCPItem(name);
  }
  
  public void setSuperClass(CP name)
  {
    super_class = name;addCPItem(name);
  }
  
  public void setClassAccess(short access)
  {
    class_access = access;
  }
  
  public void addInterface(CP ifc)
  {
    addCPItem(ifc);
    interfaces.addElement(ifc);
  }
  
  public void addInterface(CP[] ilist)
  {
    for (int i = 0; i < ilist.length; i++)
    {
      interfaces.addElement(ilist[i]);
      addCPItem(ilist[i]);
    }
  }
  
  public void addField(Var v)
  {
    vars.addElement(v);
    v.resolve(this);
  }
  
  public void write(DataOutputStream out)
    throws IOException, jasError
  {
    out.writeInt(magic);
    out.writeShort(version_lo);
    out.writeShort(version_hi);
    
    int curidx = 1;
    
    cpe_index = new Hashtable();
    for (Enumeration e = cpe.elements(); e.hasMoreElements();)
    {
      CP tmp = (CP)e.nextElement();
      cpe_index.put(tmp.getUniq(), new Integer(curidx));
      curidx++;
      if (((tmp instanceof LongCP)) || ((tmp instanceof DoubleCP))) {
        curidx++;
      }
    }
    out.writeShort((short)curidx);
    for (Enumeration e = cpe.elements(); e.hasMoreElements();)
    {
      CP now = (CP)e.nextElement();
      now.write(this, out);
    }
    out.writeShort(class_access);
    out.writeShort(getCPIndex(this_class));
    if (super_class == null) {
      out.writeShort(0);
    } else {
      out.writeShort(getCPIndex(super_class));
    }
    out.writeShort(interfaces.size());
    for (Enumeration e = interfaces.elements(); e.hasMoreElements();)
    {
      CP c = (CP)e.nextElement();
      out.writeShort(getCPIndex(c));
    }
    out.writeShort(vars.size());
    for (Enumeration e = vars.elements(); e.hasMoreElements();)
    {
      Var v = (Var)e.nextElement();
      v.write(this, out);
    }
    out.writeShort(methods.size());
    for (Enumeration e = methods.elements(); e.hasMoreElements();)
    {
      Method m = (Method)e.nextElement();
      m.write(this, out);
    }
    short numExtra = 0;
    if (source != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (debug != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (enclosing != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (signature != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (innerclasses != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (depr != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (annVis != null) {
      numExtra = (short)(numExtra + 1);
    }
    if (annInvis != null) {
      numExtra = (short)(numExtra + 1);
    }
    numExtra = (short)(numExtra + generic.size());
    
    out.writeShort(numExtra);
    if (source != null) {
      source.write(this, out);
    }
    if (debug != null) {
      debug.write(this, out);
    }
    if (enclosing != null) {
      enclosing.write(this, out);
    }
    if (signature != null) {
      signature.write(this, out);
    }
    if (innerclasses != null) {
      innerclasses.write(this, out);
    }
    if (depr != null) {
      depr.write(this, out);
    }
    if (annVis != null) {
      annVis.write(this, out);
    }
    if (annInvis != null) {
      annInvis.write(this, out);
    }
    for (Enumeration gen = generic.elements(); gen.hasMoreElements();)
    {
      GenericAttr gattr = (GenericAttr)gen.nextElement();
      gattr.write(this, out);
    }
    out.flush();
  }
  
  public void addCPItem(CP cp)
  {
    String uniq = cp.getUniq();
    CP intern;
    if ((intern = (CP)cpe.get(uniq)) == null)
    {
      cpe.put(uniq, cp);
      
      cp.resolve(this);
    }
  }
  
  public void setSource(SourceAttr source)
  {
    this.source = source;source.resolve(this);
  }
  
  public void setSource(String source)
  {
    this.source = new SourceAttr(source);this.source.resolve(this);
  }
  
  public void setSourceDebugExtension(String debug)
  {
    if (this.debug != null)
    {
      this.debug.append(debug);
    }
    else
    {
      this.debug = new SourceDebugExtensionAttr(debug);
      this.debug.resolve(this);
    }
  }
  
  public void setEnclosingMethod(String cls, String mtd, String dsc)
  {
    enclosing = new EnclosingMethodAttr(cls, mtd, dsc);
    enclosing.resolve(this);
  }
  
  public void setSignature(String sig)
  {
    signature = new SignatureAttr(sig);
    signature.resolve(this);
  }
  
  public void setDeprecated(DeprecatedAttr depr)
  {
    this.depr = depr;depr.resolve(this);
  }
  
  public void addGenericAttr(GenericAttr g)
  {
    generic.addElement(g);g.resolve(this);
  }
  
  public void addInnerClass(short iacc, String name, String inner, String outer)
  {
    if (innerclasses == null)
    {
      innerclasses = new InnerClassesAttr();
      innerclasses.resolve(this);
    }
    InnerClass ic = new InnerClass(iacc, name, inner, outer);
    ic.resolve(this);
    innerclasses.addInnerClass(ic);
  }
  
  public Annotation addAnnotation(boolean visible, String clsname)
  {
    Annotation ann = new Annotation(clsname);
    AnnotationAttr aa = visible ? annVis : annInvis;
    if (aa == null)
    {
      aa = new AnnotationAttr(visible);
      if (visible) {
        annVis = aa;
      } else {
        annInvis = aa;
      }
    }
    aa.add(ann);
    return ann;
  }
  
  public void endHeader()
  {
    if (annVis != null) {
      annVis.resolve(this);
    }
    if (annInvis != null) {
      annInvis.resolve(this);
    }
  }
  
  public void addMethod(Method m)
  {
    m.resolve(this);
    methods.addElement(m);
  }
  
  short getCPIndex(CP cp)
    throws jasError
  {
    if (cpe_index == null) {
      throw new jasError("Internal error: CPE index has not been generated");
    }
    Integer idx = (Integer)cpe_index.get(cp.getUniq());
    if (idx == null) {
      throw new jasError("Item " + cp + " not in the class");
    }
    return (short)idx.intValue();
  }
  
  public void setVersion(short version_high, short version_low)
  {
    version_hi = version_high;
    version_lo = version_low;
  }
}

/* Location:
 * Qualified Name:     jas.ClassEnv
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class CodeAttr
{
  static final CP attr = new AsciiCP("Code");
  short stack_size;
  short num_locals;
  int code_size;
  Vector insns;
  Hashtable insn_pc;
  Catchtable ctb;
  LineTableAttr ltab;
  LocalVarTableAttr lvar;
  LocalVarTypeTableAttr lvtyp;
  StackMap stackmap;
  Vector generic;
  
  public CodeAttr()
  {
    stack_size = 1;
    num_locals = 1;
    ctb = null;
    insns = new Vector();
    generic = new Vector();
  }
  
  public void setCatchtable(Catchtable ctb)
  {
    this.ctb = ctb;
  }
  
  public void setLineTable(LineTableAttr ltab)
  {
    this.ltab = ltab;
  }
  
  public void setLocalVarTable(LocalVarTableAttr lvar)
  {
    this.lvar = lvar;
  }
  
  public void setLocalVarTypeTable(LocalVarTypeTableAttr lvtyp)
  {
    this.lvtyp = lvtyp;
  }
  
  public void setStackMap(StackMap s)
  {
    stackmap = s;
  }
  
  public void addGenericAttr(GenericAttr g)
  {
    generic.addElement(g);
  }
  
  public void addInsn(Insn insn)
  {
    insns.addElement(insn);
  }
  
  public void setStackSize(short stack_size)
  {
    this.stack_size = stack_size;
  }
  
  public void setVarSize(short num_vars)
  {
    num_locals = num_vars;
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    for (Enumeration en = insns.elements(); en.hasMoreElements();)
    {
      Insn i = (Insn)en.nextElement();
      i.resolve(e);
    }
    if (ctb != null) {
      ctb.resolve(e);
    }
    if (ltab != null) {
      ltab.resolve(e);
    }
    if (lvar != null) {
      lvar.resolve(e);
    }
    if (lvtyp != null) {
      lvtyp.resolve(e);
    }
    if (stackmap != null) {
      stackmap.resolve(e);
    }
    for (Enumeration gen = generic.elements(); gen.hasMoreElements();)
    {
      GenericAttr gattr = (GenericAttr)gen.nextElement();
      gattr.resolve(e);
    }
  }
  
  int getPc(Insn i)
    throws jasError
  {
    if (insn_pc == null) {
      throw new jasError("Internal error, insn_pc has not been initialized");
    }
    Integer tmp;
    Integer tmp;
    if ((i instanceof Label)) {
      tmp = (Integer)insn_pc.get(id);
    } else {
      tmp = (Integer)insn_pc.get(i);
    }
    if (tmp == null) {
      throw new jasError(i + " has not been added to the code");
    }
    return tmp.intValue();
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    int code_size = 0;
    insn_pc = new Hashtable();
    for (Enumeration en = insns.elements(); en.hasMoreElements();)
    {
      Insn now = (Insn)en.nextElement();
      if ((now instanceof Label)) {
        insn_pc.put(id, new Integer(code_size));
      } else {
        insn_pc.put(now, new Integer(code_size));
      }
      code_size += now.size(e, this);
    }
    int total_size = code_size;
    if (ctb != null) {
      total_size += ctb.size();
    }
    if (ltab != null) {
      total_size += ltab.size();
    }
    if (lvar != null) {
      total_size += lvar.size();
    }
    if (lvtyp != null) {
      total_size += lvtyp.size();
    }
    if (stackmap != null) {
      total_size += stackmap.size(e, this);
    }
    for (Enumeration gen = generic.elements(); gen.hasMoreElements();)
    {
      GenericAttr gattr = (GenericAttr)gen.nextElement();
      total_size += gattr.size();
    }
    total_size += 12;
    
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(total_size);
    out.writeShort(stack_size);
    out.writeShort(num_locals);
    out.writeInt(code_size);
    for (Enumeration en = insns.elements(); en.hasMoreElements();)
    {
      Insn now = (Insn)en.nextElement();
      now.write(e, this, out);
    }
    if (ctb != null) {
      ctb.write(e, this, out);
    } else {
      out.writeShort(0);
    }
    short extra = 0;
    if (ltab != null) {
      extra = (short)(extra + 1);
    }
    if (lvar != null) {
      extra = (short)(extra + 1);
    }
    if (lvtyp != null) {
      extra = (short)(extra + 1);
    }
    if (stackmap != null) {
      extra = (short)(extra + 1);
    }
    extra = (short)(extra + generic.size());
    out.writeShort(extra);
    if (ltab != null) {
      ltab.write(e, this, out);
    }
    if (lvar != null) {
      lvar.write(e, this, out);
    }
    if (lvtyp != null) {
      lvtyp.write(e, this, out);
    }
    if (stackmap != null) {
      stackmap.write(e, this, out);
    }
    for (Enumeration gen = generic.elements(); gen.hasMoreElements();)
    {
      GenericAttr gattr = (GenericAttr)gen.nextElement();
      gattr.write(e, out);
    }
  }
  
  public String toString()
  {
    return "<#code-attr>";
  }
}

/* Location:
 * Qualified Name:     jas.CodeAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class ConstAttr
{
  static final CP attr = new AsciiCP("ConstantValue");
  CP val;
  
  public ConstAttr(CP val)
  {
    this.val = val;
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(val);
    e.addCPItem(attr);
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(2);
    out.writeShort(e.getCPIndex(val));
  }
}

/* Location:
 * Qualified Name:     jas.ConstAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public abstract class CP
{
  String uniq;
  
  String getUniq()
  {
    return uniq;
  }
  
  abstract void resolve(ClassEnv paramClassEnv);
  
  abstract void write(ClassEnv paramClassEnv, DataOutputStream paramDataOutputStream)
    throws IOException, jasError;
}

/* Location:
 * Qualified Name:     jas.CP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

class CPOperand
  extends InsnOperand
{
  CP cpe;
  boolean wide;
  
  int size(ClassEnv ce, CodeAttr code)
  {
    if (wide) {
      return 2;
    }
    return 1;
  }
  
  CPOperand(CP cpe)
  {
    this.cpe = cpe;wide = true;
  }
  
  CPOperand(CP cpe, boolean wide)
  {
    this.cpe = cpe;this.wide = wide;
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(cpe);
  }
  
  void write(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException, jasError
  {
    int idx = e.getCPIndex(cpe);
    if (wide)
    {
      out.writeShort((short)idx);
    }
    else
    {
      if (idx > 255) {
        throw new jasError("exceeded size for small cpidx" + cpe);
      }
      out.writeByte((byte)(0xFF & idx));
    }
  }
}

/* Location:
 * Qualified Name:     jas.CPOperand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class DeprecatedAttr
{
  static final CP attr = new AsciiCP("Deprecated");
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(0);
  }
}

/* Location:
 * Qualified Name:     jas.DeprecatedAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class DoubleCP
  extends CP
  implements RuntimeConstants
{
  double val;
  
  public DoubleCP(double n)
  {
    uniq = ("Double: @#$" + n).intern();
    val = n;
  }
  
  void resolve(ClassEnv e) {}
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException
  {
    out.writeByte(6);
    out.writeDouble(val);
  }
}

/* Location:
 * Qualified Name:     jas.DoubleCP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class EnclosingMethodAttr
{
  static final CP attr = new AsciiCP("EnclosingMethod");
  CP clscp;
  CP ntcp;
  String cls;
  String mtd;
  String dsc;
  
  public EnclosingMethodAttr(String cls, String mtd, String dsc)
  {
    this.cls = cls;
    this.mtd = mtd;
    this.dsc = dsc;
    clscp = new ClassCP(cls);
    if ((mtd != null) && (dsc != null)) {
      ntcp = new NameTypeCP(mtd, dsc);
    }
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    e.addCPItem(clscp);
    clscp.resolve(e);
    if (ntcp != null)
    {
      e.addCPItem(ntcp);
      ntcp.resolve(e);
    }
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr));
    out.writeInt(4);
    out.writeShort(e.getCPIndex(clscp));
    out.writeShort(ntcp == null ? 0 : e.getCPIndex(ntcp));
  }
}

/* Location:
 * Qualified Name:     jas.EnclosingMethodAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class ExceptAttr
{
  static final CP attr = new AsciiCP("Exceptions");
  Vector cps = new Vector();
  
  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()));
    }
  }
}

/* Location:
 * Qualified Name:     jas.ExceptAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class FieldCP
  extends CP
  implements RuntimeConstants
{
  ClassCP clazz;
  NameTypeCP nt;
  
  public FieldCP(String clazz, String name, String sig)
  {
    uniq = (clazz + "&%$#&" + name + "*()#$" + sig).intern();
    this.clazz = new ClassCP(clazz);
    nt = new NameTypeCP(name, sig);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(clazz);
    e.addCPItem(nt);
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeByte(9);
    out.writeShort(e.getCPIndex(clazz));
    out.writeShort(e.getCPIndex(nt));
  }
}

/* Location:
 * Qualified Name:     jas.FieldCP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class FloatCP
  extends CP
  implements RuntimeConstants
{
  float val;
  
  public FloatCP(float n)
  {
    uniq = ("Float: @#$" + n).intern();
    val = n;
  }
  
  void resolve(ClassEnv e) {}
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException
  {
    out.writeByte(4);
    out.writeFloat(val);
  }
}

/* Location:
 * Qualified Name:     jas.FloatCP
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class GenericAttr
{
  CP attr_name;
  byte[] data;
  
  public GenericAttr(String name, byte[] data)
  {
    attr_name = new AsciiCP(name);
    this.data = data;
  }
  
  public GenericAttr(CP name, byte[] data)
  {
    attr_name = name;
    this.data = data;
  }
  
  public GenericAttr(String name, String file)
    throws IOException, jasError
  {
    FileInputStream inp;
    try
    {
      inp = new FileInputStream(file);
    }
    catch (FileNotFoundException e)
    {
      throw new jasError("Generic atribute file " + file + " not found");
    }
    data = new byte[inp.available()];
    inp.read(data);
    inp.close();
    attr_name = new AsciiCP(name);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr_name);
  }
  
  int size()
  {
    return 6 + data.length;
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    out.writeShort(e.getCPIndex(attr_name));
    out.writeInt(data.length);
    out.write(data);
  }
}

/* Location:
 * Qualified Name:     jas.GenericAttr
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

public class IincInsn
  extends Insn
  implements RuntimeConstants
{
  public IincInsn(int vindex, int increment, boolean Wide)
  {
    opc = 132;
    operand = new IincOperand(vindex, increment, Wide);
  }
}

/* Location:
 * Qualified Name:     jas.IincInsn
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

class IincOperand
  extends InsnOperand
  implements RuntimeConstants
{
  int vindex;
  int constt;
  boolean Wide;
  
  IincOperand(int vindex, int constt, boolean Wide)
  {
    this.vindex = vindex;
    this.constt = constt;
    this.Wide = ((Wide) || (vindex > 255) || (constt > 127) || (constt < 127));
  }
  
  int size(ClassEnv ce, CodeAttr code)
  {
    return Wide ? 5 : 2;
  }
  
  void resolve(ClassEnv e) {}
  
  void writePrefix(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException
  {
    if (Wide) {
      out.writeByte(-60);
    }
  }
  
  void write(ClassEnv e, CodeAttr ce, DataOutputStream out)
    throws IOException
  {
    if (Wide)
    {
      out.writeShort((short)(0xFFFF & vindex));
      out.writeShort((short)(0xFFFF & constt));
    }
    else
    {
      out.writeByte((byte)(0xFF & vindex));
      out.writeByte((byte)(0xFF & constt));
    }
  }
}

/* Location:
 * Qualified Name:     jas.IincOperand
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;

public class InnerClass
{
  ClassCP inner;
  ClassCP outer;
  CP name;
  short access;
  
  public static int size()
  {
    return 8;
  }
  
  public InnerClass(short access, String name, String inner, String outer)
  {
    this.access = access;
    this.name = null;
    if (name != null) {
      this.name = new AsciiCP(name);
    }
    this.inner = null;
    if (inner != null) {
      this.inner = new ClassCP(inner);
    }
    this.outer = null;
    if (outer != null) {
      this.outer = new ClassCP(outer);
    }
  }
  
  void resolve(ClassEnv e)
  {
    if (name != null) {
      e.addCPItem(name);
    }
    if (inner != null)
    {
      e.addCPItem(inner);
      inner.resolve(e);
    }
    if (outer != null)
    {
      e.addCPItem(outer);
      outer.resolve(e);
    }
  }
  
  void write(ClassEnv e, DataOutputStream out)
    throws IOException, jasError
  {
    short id = 0;
    if (inner != null) {
      id = e.getCPIndex(inner);
    }
    out.writeShort(id);
    id = 0;
    if (outer != null) {
      id = e.getCPIndex(outer);
    }
    out.writeShort(id);
    id = 0;
    if (name != null) {
      id = e.getCPIndex(name);
    }
    out.writeShort(id);
    out.writeShort(access);
  }
}

/* Location:
 * Qualified Name:     jas.InnerClass
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package jas;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public class InnerClassesAttr
{
  static final CP attr = new AsciiCP("InnerClasses");
  private Vector list = new Vector();
  
  public void addInnerClass(InnerClass item)
  {
    list.add(item);
  }
  
  void resolve(ClassEnv e)
  {
    e.addCPItem(attr);
    for (Enumeration en = list.e
1 2 3 4 5 6 7

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd