emma

lection)m_fields.clone());
      m_methods = ((IMethodCollection)m_methods.clone());
      m_attributes = ((IAttributeCollection)m_attributes.clone());
      
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    if (out == null) {
      throw new IllegalArgumentException("null input: out");
    }
    out.writeU4(m_magic);
    
    out.writeU2(m_version[1]);
    out.writeU2(m_version[0]);
    
    m_constants.writeInClassFormat(out);
    
    out.writeU2(m_access_flags);
    
    out.writeU2(m_this_class_index);
    out.writeU2(m_super_class_index);
    
    m_interfaces.writeInClassFormat(out);
    m_fields.writeInClassFormat(out);
    m_methods.writeInClassFormat(out);
    m_attributes.writeInClassFormat(out);
  }
  
  public final long getDeclaredSUID()
  {
    return m_declaredSUID;
  }
  
  public final long computeSUID(boolean skipCLINIT)
  {
    long result = m_declaredSUID;
    if (result != 0L) {
      return result;
    }
    try
    {
      ByteArrayOStream bout = new ByteArrayOStream(1024);
      DataOutputStream dout = new DataOutputStream(bout);
      
      dout.writeUTF(Types.vmNameToJavaName(getName()));
      
      int[] nestedAccessFlags = new int[1];
      
      int modifiers = (isNested(nestedAccessFlags) ? nestedAccessFlags[0] : getAccessFlags()) & 0x611;
      
      dout.writeInt(modifiers);
      
      IInterfaceCollection interfaces = getInterfaces();
      String[] ifcs = new String[interfaces.size()];
      
      int iLimit = ifcs.length;
      for (int i = 0; i < iLimit; i++) {
        ifcs[i] = Types.vmNameToJavaName(((CONSTANT_Class_info)m_constants.get(interfaces.get(i))).getName(this));
      }
      Arrays.sort(ifcs);
      for (int i = 0; i < iLimit; i++) {
        dout.writeUTF(ifcs[i]);
      }
      IFieldCollection fields = getFields();
      FieldDescriptor[] fds = new FieldDescriptor[fields.size()];
      
      int fcount = 0;
      int f = 0;
      for (int fLimit = fds.length; f < fLimit; f++)
      {
        Field_info field = fields.get(f);
        int modifiers = field.getAccessFlags();
        if (((modifiers & 0x2) == 0) || ((modifiers & 0x88) == 0)) {
          fds[(fcount++)] = new FieldDescriptor(field.getName(this), modifiers, field.getDescriptor(this));
        }
      }
      if (fcount > 0)
      {
        Arrays.sort(fds, 0, fcount);
        for (int i = 0; i < fcount; i++)
        {
          FieldDescriptor fd = fds[i];
          
          dout.writeUTF(m_name);
          dout.writeInt(m_modifiers);
          dout.writeUTF(m_descriptor);
        }
      }
      IMethodCollection methods = getMethods();
      
      boolean hasCLINIT = false;
      ConstructorDescriptor[] cds = new ConstructorDescriptor[methods.size()];
      MethodDescriptor[] mds = new MethodDescriptor[cds.length];
      
      int ccount = 0;int mcount = 0;
      
      int i = 0;
      for (int iLimit = cds.length; i < iLimit; i++)
      {
        Method_info method = methods.get(i);
        
        String name = method.getName(this);
        if ((!hasCLINIT) && ("<clinit>".equals(name)))
        {
          hasCLINIT = true;
        }
        else
        {
          int modifiers = method.getAccessFlags();
          if ((modifiers & 0x2) == 0) {
            if ("<init>".equals(name)) {
              cds[(ccount++)] = new ConstructorDescriptor(modifiers, method.getDescriptor(this));
            } else {
              mds[(mcount++)] = new MethodDescriptor(name, modifiers, method.getDescriptor(this));
            }
          }
        }
      }
      if ((hasCLINIT) && (!skipCLINIT))
      {
        dout.writeUTF("<clinit>");
        dout.writeInt(8);
        dout.writeUTF("()V");
      }
      if (ccount > 0)
      {
        Arrays.sort(cds, 0, ccount);
        for (int i = 0; i < ccount; i++)
        {
          ConstructorDescriptor cd = cds[i];
          
          dout.writeUTF("<init>");
          dout.writeInt(m_modifiers);
          dout.writeUTF(m_descriptor.replace('/', '.'));
        }
      }
      if (mcount > 0)
      {
        Arrays.sort(mds, 0, mcount);
        for (int i = 0; i < mcount; i++)
        {
          MethodDescriptor md = mds[i];
          
          dout.writeUTF(m_name);
          dout.writeInt(m_modifiers);
          dout.writeUTF(m_descriptor.replace('/', '.'));
        }
      }
      dout.flush();
      
      MessageDigest md = MessageDigest.getInstance("SHA");
      
      md.update(bout.getByteArray(), 0, bout.size());
      byte[] hash = md.digest();
      for (int i = Math.min(hash.length, 8) - 1; i >= 0; i--) {
        result = result << 8 | hash[i] & 0xFF;
      }
      return result;
    }
    catch (IOException ioe)
    {
      throw new Error(ioe.getMessage());
    }
    catch (NoSuchAlgorithmException nsae)
    {
      throw new SecurityException(nsae.getMessage());
    }
  }
  
  public int addCONSTANT_Utf8(String value, boolean keepUnique)
  {
    if (keepUnique)
    {
      int existing = m_constants.findCONSTANT_Utf8(value);
      if (existing > 0) {
        return existing;
      }
    }
    return m_constants.add(new CONSTANT_Utf8_info(value));
  }
  
  public int addStringConstant(String value)
  {
    int value_index = addCONSTANT_Utf8(value, true);
    
    return m_constants.add(new CONSTANT_String_info(value_index));
  }
  
  public int addNameType(String name, String typeDescriptor)
  {
    int name_index = addCONSTANT_Utf8(name, true);
    int descriptor_index = addCONSTANT_Utf8(typeDescriptor, true);
    
    return m_constants.add(new CONSTANT_NameAndType_info(name_index, descriptor_index));
  }
  
  public int addClassref(String classJVMName)
  {
    int name_index = addCONSTANT_Utf8(classJVMName, true);
    
    return m_constants.add(new CONSTANT_Class_info(name_index));
  }
  
  public int addField(String name, String descriptor, int access_flags)
  {
    int name_index = addCONSTANT_Utf8(name, true);
    int descriptor_index = addCONSTANT_Utf8(descriptor, true);
    
    Field_info field = new Field_info(access_flags, name_index, descriptor_index, ElementFactory.newAttributeCollection(0));
    
    return m_fields.add(field);
  }
  
  public int addField(String name, String descriptor, int access_flags, IAttributeCollection attributes)
  {
    int name_index = addCONSTANT_Utf8(name, true);
    int descriptor_index = addCONSTANT_Utf8(descriptor, true);
    
    Field_info field = new Field_info(access_flags, name_index, descriptor_index, attributes);
    
    return m_fields.add(field);
  }
  
  public Method_info newEmptyMethod(String name, String descriptor, int access_flags)
  {
    int attribute_name_index = addCONSTANT_Utf8("Code", true);
    int name_index = addCONSTANT_Utf8(name, true);
    int descriptor_index = addCONSTANT_Utf8(descriptor, true);
    
    IAttributeCollection attributes = ElementFactory.newAttributeCollection(0);
    CodeAttribute_info code = new CodeAttribute_info(attribute_name_index, 0, 0, CodeAttribute_info.EMPTY_BYTE_ARRAY, AttributeElementFactory.newExceptionHandlerTable(0), ElementFactory.newAttributeCollection(0));
    
    attributes.add(code);
    
    Method_info method = new Method_info(access_flags, name_index, descriptor_index, attributes);
    
    return method;
  }
  
  public int addMethod(Method_info method)
  {
    return m_methods.add(method);
  }
  
  public int addFieldref(Field_info field)
  {
    CONSTANT_NameAndType_info nametype = new CONSTANT_NameAndType_info(m_name_index, m_descriptor_index);
    int nametype_index = m_constants.add(nametype);
    
    return m_constants.add(new CONSTANT_Fieldref_info(m_this_class_index, nametype_index));
  }
  
  public int addFieldref(int offset)
  {
    Field_info field = m_fields.get(offset);
    
    CONSTANT_NameAndType_info nametype = new CONSTANT_NameAndType_info(m_name_index, m_descriptor_index);
    int nametype_index = m_constants.add(nametype);
    
    return m_constants.add(new CONSTANT_Fieldref_info(m_this_class_index, nametype_index));
  }
  
  private static final class FieldDescriptor
    implements Comparable
  {
    final String m_name;
    final int m_modifiers;
    final String m_descriptor;
    
    public final int compareTo(Object obj)
    {
      return m_name.compareTo(m_name);
    }
    
    FieldDescriptor(String name, int modifiers, String descriptor)
    {
      m_name = name;
      m_modifiers = modifiers;
      m_descriptor = descriptor;
    }
  }
  
  private static final class ConstructorDescriptor
    implements Comparable
  {
    final int m_modifiers;
    final String m_descriptor;
    
    public final int compareTo(Object obj)
    {
      return m_descriptor.compareTo(m_descriptor);
    }
    
    ConstructorDescriptor(int modifiers, String descriptor)
    {
      m_modifiers = modifiers;
      m_descriptor = descriptor;
    }
  }
  
  private static final class MethodDescriptor
    implements Comparable
  {
    final String m_name;
    final int m_modifiers;
    final String m_descriptor;
    
    public final int compareTo(Object obj)
    {
      MethodDescriptor rhs = (MethodDescriptor)obj;
      
      int result = m_name.compareTo(m_name);
      if (result == 0) {
        result = m_descriptor.compareTo(m_descriptor);
      }
      return result;
    }
    
    MethodDescriptor(String name, int modifiers, String descriptor)
    {
      m_name = name;
      m_modifiers = modifiers;
      m_descriptor = descriptor;
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.ClassDef
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.constant.CONSTANT_info;
import java.util.List;

final class ConstantCollection$ConstantIterator
  implements IConstantCollection.IConstantIterator
{
  private int m_index;
  private int m_prev_index;
  private int m_next_index;
  private List m_constants;
  
  ConstantCollection$ConstantIterator(List constants)
  {
    m_constants = constants;
    m_next_index = 1;
    shift();
  }
  
  public int nextIndex()
  {
    int result = m_index;
    shift();
    
    return result;
  }
  
  public CONSTANT_info nextConstant()
  {
    int nextIndex = nextIndex();
    if (nextIndex < 0) {
      return null;
    }
    return (CONSTANT_info)m_constants.get(nextIndex - 1);
  }
  
  public CONSTANT_info set(CONSTANT_info constant)
  {
    int zindex = m_prev_index - 1;
    CONSTANT_info result = (CONSTANT_info)m_constants.get(zindex);
    if (result == null) {
      throw new IllegalStateException("assertion failure: dereferencing an invalid constant pool slot " + m_prev_index);
    }
    if (result.width() != constant.width()) {
      throw new IllegalArgumentException("assertion failure: can't set entry of type [" + result.getClass().getName() + "] to an entry of type [" + result.getClass().getName() + "] at pool slot " + m_prev_index);
    }
    m_constants.set(zindex, constant);
    
    return result;
  }
  
  private void shift()
  {
    m_prev_index = m_index;
    m_index = m_next_index;
    if (m_index > 0) {
      try
      {
        CONSTANT_info entry = (CONSTANT_info)m_constants.get(m_index - 1);
        
        m_next_index += entry.width();
        if (m_next_index > m_constants.size()) {
          m_next_index = -1;
        }
      }
      catch (IndexOutOfBoundsException ioobe)
      {
        m_index = (m_next_index = -1);
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.ConstantCollection.ConstantIterator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.constant.CONSTANT_Utf8_info;
import com.vladium.jcd.cls.constant.CONSTANT_info;
import com.vladium.jcd.lib.UDataOutputStream;
import com.vladium.util.ObjectIntMap;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

final class ConstantCollection
  implements IConstantCollection
{
  private List m_constants;
  private int m_size;
  private transient ObjectIntMap m_CONSTANT_Utf8_index;
  
  public CONSTANT_info get(int index)
  {
    Object result = m_constants.get(index - 1);
    if (result == null) {
      throw new IllegalStateException("assertion failure: dereferencing an invalid constant pool slot " + index);
    }
    return (CONSTANT_info)result;
  }
  
  public IConstantCollection.IConstantIterator iterator()
  {
    return new ConstantIterator(m_constants);
  }
  
  public int find(int type, IConstantCollection.IConstantComparator comparator)
  {
    if (comparator == null) {
      throw new IllegalArgumentException("null input: comparator");
    }
    for (int i = 0; i < m_constants.size(); i++)
    {
      CONSTANT_info constant = (CONSTANT_info)m_constants.get(i);
      if ((constant != null) && (constant.tag() == type) && (comparator.equals(constant))) {
        return i + 1;
      }
    }
    return -1;
  }
  
  public int findCONSTANT_Utf8(String value)
  {
    if (value == null) {
      throw new IllegalArgumentException("null input: value");
    }
    ObjectIntMap index = getCONSTANT_Utf8_index();
    int[] result = new int[1];
    if (index.get(value, result)) {
      return result[0] + 1;
    }
    return -1;
  }
  
  public int size()
  {
    return m_size;
  }
  
  public Object clone()
  {
    try
    {
      ConstantCollection _clone = (ConstantCollection)super.clone();
      
      int constants_count = m_constants.size();
      m_constants = new ArrayList(constants_count);
      for (int c = 0; c < constants_count; c++)
      {
        CONSTANT_info constant = (CONSTANT_info)m_constants.get(c);
        m_constants.add(constant == null ? null : constant.clone());
      }
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    int constant_pool_count = m_constants.size();
    out.writeU2(constant_pool_count + 1);
    
    ConstantIterator i = new ConstantIterator(m_constants);
    CONSTANT_info entry;
    while ((entry = i.nextConstant()) != null) {
      entry.writeInClassFormat(out);
    }
  }
  
  public void accept(IClassDefVisitor visitor, Object ctx)
  {
    visitor.visit(this, ctx);
  }
  
  public CONSTANT_info set(int index, CONSTANT_info constant)
  {
    int zindex = index - 1;
    CONSTANT_info result = (CONSTANT_info)m_constants.get(zindex);
    if (result == null) {
      throw new IllegalStateException("assertion failure: dereferencing an invalid constant pool slot " + index);
    }
    if (result.width() != constant.width()) {
      throw new IllegalArgumentException("assertion failure: can't set entry of type [" + result.getClass().getName() + "] to an entry of type [" + result.getClass().getName() + "] at pool slot " + index);
    }
    m_constants.set(zindex, constant);
    if (m_CONSTANT_Utf8_index != null)
    {
      if ((result instanceof CONSTANT_Utf8_info))
      {
        String mapKey = m_value;
        int[] out = new int[1];
        if ((m_CONSTANT_Utf8_index.get(mapKey, out)) && (out[0] == zindex)) {
          m_CONSTANT_Utf8_index.remove(mapKey);
        }
      }
      if ((constant instanceof CONSTANT_Utf8_info)) {
        m_CONSTANT_Utf8_index.put(m_value, zindex);
      }
    }
    return result;
  }
  
  public int add(CONSTANT_info constant)
  {
    m_constants.add(constant);
    m_size += 1;
    int result = m_constants.size();
    for (int width = 1; width < constant.width(); width++)
    {
      m_size += 1;
      m_constants.add(null);
    }
    if ((m_CONSTANT_Utf8_index != null) && ((constant instanceof CONSTANT_Utf8_info))) {
      m_CONSTANT_Utf8_index.put(m_value, result - 1);
    }
    return result;
  }
  
  ConstantCollection(int capacity)
  {
    m_constants = (capacity < 0 ? new ArrayList() : new ArrayList(capacity));
  }
  
  private static final class ConstantIterator
    implements IConstantCollection.IConstantIterator
  {
    private int m_index;
    private int m_prev_index;
    private int m_next_index;
    private List m_constants;
    
    ConstantIterator(List constants)
    {
      m_constants = constants;
      m_next_index = 1;
      shift();
    }
    
    public int nextIndex()
    {
      int result = m_index;
      shift();
      
      return result;
    }
    
    public CONSTANT_info nextConstant()
    {
      int nextIndex = nextIndex();
      if (nextIndex < 0) {
        return null;
      }
      return (CONSTANT_info)m_constants.get(nextIndex - 1);
    }
    
    public CONSTANT_info set(CONSTANT_info constant)
    {
      int zindex = m_prev_index - 1;
      CONSTANT_info result = (CONSTANT_info)m_constants.get(zindex);
      if (result == null) {
        throw new IllegalStateException("assertion failure: dereferencing an invalid constant pool slot " + m_prev_index);
      }
      if (result.width() != constant.width()) {
        throw new IllegalArgumentException("assertion failure: can't set entry of type [" + result.getClass().getName() + "] to an entry of type [" + result.getClass().getName() + "] at pool slot " + m_prev_index);
      }
      m_constants.set(zindex, constant);
      
      return result;
    }
    
    private void shift()
    {
      m_prev_index = m_index;
      m_index = m_next_index;
      if (m_index > 0) {
        try
        {
          CONSTANT_info entry = (CONSTANT_info)m_constants.get(m_index - 1);
          
          m_next_index += entry.width();
          if (m_next_index > m_constants.size()) {
            m_next_index = -1;
          }
        }
        catch (IndexOutOfBoundsException ioobe)
        {
          m_index = (m_next_index = -1);
        }
      }
    }
  }
  
  private ObjectIntMap getCONSTANT_Utf8_index()
  {
    if (m_CONSTANT_Utf8_index == null)
    {
      ObjectIntMap index = new ObjectIntMap(m_size);
      for (int i = 0; i < m_constants.size(); i++)
      {
        CONSTANT_info constant = (CONSTANT_info)m_constants.get(i);
        if ((constant != null) && (constant.tag() == 1)) {
          index.put(m_value, i);
        }
      }
      m_CONSTANT_Utf8_index = index;
    }
    return m_CONSTANT_Utf8_index;
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.ConstantCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

public abstract class ElementFactory
{
  public static IAttributeCollection newAttributeCollection(int capacity)
  {
    return new AttributeCollection(capacity);
  }
  
  public static IConstantCollection newConstantCollection(int capacity)
  {
    return new ConstantCollection(capacity);
  }
  
  public static IFieldCollection newFieldCollection(int capacity)
  {
    return new FieldCollection(capacity);
  }
  
  public static IInterfaceCollection newInterfaceCollection(int capacity)
  {
    return new InterfaceCollection(capacity);
  }
  
  public static IMethodCollection newMethodCollection(int capacity)
  {
    return new MethodCollection(capacity);
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.ElementFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.lib.UDataOutputStream;
import com.vladium.util.IntVector;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

final class FieldCollection
  implements IFieldCollection
{
  private List m_fields;
  
  public Field_info get(int offset)
  {
    return (Field_info)m_fields.get(offset);
  }
  
  public int[] get(ClassDef cls, String name)
  {
    if (cls == null) {
      throw new IllegalArgumentException("null input: cls");
    }
    int count = m_fields.size();
    IntVector result = new IntVector(count);
    for (int f = 0; f < count; f++)
    {
      Field_info field = (Field_info)m_fields.get(f);
      if (field.getName(cls).equals(name)) {
        result.add(f);
      }
    }
    return result.values();
  }
  
  public int size()
  {
    return m_fields.size();
  }
  
  public Object clone()
  {
    try
    {
      FieldCollection _clone = (FieldCollection)super.clone();
      
      int fields_count = m_fields.size();
      m_fields = new ArrayList(fields_count);
      for (int f = 0; f < fields_count; f++) {
        m_fields.add(((Field_info)m_fields.get(f)).clone());
      }
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    int fields_count = m_fields.size();
    out.writeU2(fields_count);
    for (int i = 0; i < fields_count; i++) {
      get(i).writeInClassFormat(out);
    }
  }
  
  public void accept(IClassDefVisitor visitor, Object ctx)
  {
    visitor.visit(this, ctx);
  }
  
  public int add(Field_info field)
  {
    int newoffset = m_fields.size();
    m_fields.add(field);
    
    return newoffset;
  }
  
  public Field_info set(int offset, Field_info field)
  {
    return (Field_info)m_fields.set(offset, field);
  }
  
  FieldCollection(int capacity)
  {
    m_fields = (capacity < 0 ? new ArrayList() : new ArrayList(capacity));
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.FieldCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.attribute.Attribute_info;
import com.vladium.jcd.cls.constant.CONSTANT_Utf8_info;
import com.vladium.jcd.lib.UDataInputStream;
import com.vladium.jcd.lib.UDataOutputStream;
import java.io.IOException;

public final class Field_info
  implements Cloneable, IAccessFlags
{
  public int m_name_index;
  public int m_descriptor_index;
  private int m_access_flags;
  private IAttributeCollection m_attributes;
  private static final boolean DEBUG = false;
  
  public Field_info(int access_flags, int name_index, int descriptor_index, IAttributeCollection attributes)
  {
    m_access_flags = access_flags;
    
    m_name_index = name_index;
    m_descriptor_index = descriptor_index;
    
    m_attributes = attributes;
  }
  
  public Field_info(IConstantCollection constants, UDataInputStream bytes)
    throws IOException
  {
    m_access_flags = bytes.readU2();
    
    m_name_index = bytes.readU2();
    m_descriptor_index = bytes.readU2();
    
    int attributes_count = bytes.readU2();
    m_attributes = ElementFactory.newAttributeCollection(attributes_count);
    for (int i = 0; i < attributes_count; i++)
    {
      Attribute_info attribute_info = Attribute_info.new_Attribute_info(constants, bytes);
      
      m_attributes.add(attribute_info);
    }
  }
  
  public String getName(ClassDef cls)
  {
    return getConstantsgetm_name_index)).m_value;
  }
  
  public String getDescriptor(ClassDef cls)
  {
    return getConstantsgetm_descriptor_index)).m_value;
  }
  
  public boolean isSynthetic()
  {
    return m_attributes.hasSynthetic();
  }
  
  public final void setAccessFlags(int flags)
  {
    m_access_flags = flags;
  }
  
  public final int getAccessFlags()
  {
    return m_access_flags;
  }
  
  public IAttributeCollection getAttributes()
  {
    return m_attributes;
  }
  
  public String toString()
  {
    return "field_info: [modifiers: 0x" + Integer.toHexString(m_access_flags) + ", name_index = " + m_name_index + ", descriptor_index = " + m_descriptor_index + ']';
  }
  
  public Object clone()
  {
    try
    {
      Field_info _clone = (Field_info)super.clone();
      
      m_attributes = ((IAttributeCollection)m_attributes.clone());
      
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    out.writeU2(m_access_flags);
    
    out.writeU2(m_name_index);
    out.writeU2(m_descriptor_index);
    
    m_attributes.writeInClassFormat(out);
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.Field_info
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

public abstract interface IAccessFlags
{
  public static final int ACC_PUBLIC = 1;
  public static final int ACC_PRIVATE = 2;
  public static final int ACC_PROTECTED = 4;
  public static final int ACC_STATIC = 8;
  public static final int ACC_FINAL = 16;
  public static final int ACC_SYNCHRONIZED = 32;
  public static final int ACC_SUPER = 32;
  public static final int ACC_VOLATILE = 64;
  public static final int ACC_BRIDGE = 64;
  public static final int ACC_TRANSIENT = 128;
  public static final int ACC_NATIVE = 256;
  public static final int ACC_INTERFACE = 512;
  public static final int ACC_ABSTRACT = 1024;
  public static final int[] ALL_ACC = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 };
  public static final String[] ALL_ACC_NAMES = { "public", "private", "protected", "static", "final", "synchronized", "volatile", "transient", "native", "interface", "abstract" };
  
  public abstract void setAccessFlags(int paramInt);
  
  public abstract int getAccessFlags();
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IAccessFlags
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.attribute.Attribute_info;
import com.vladium.jcd.cls.attribute.InnerClassesAttribute_info;
import com.vladium.jcd.compiler.IClassFormatOutput;

public abstract interface IAttributeCollection
  extends Cloneable, IClassFormatOutput
{
  public abstract Attribute_info get(int paramInt);
  
  public abstract boolean hasSynthetic();
  
  public abstract boolean hasBridge();
  
  public abstract InnerClassesAttribute_info getInnerClassesAttribute();
  
  public abstract int size();
  
  public abstract long length();
  
  public abstract Object clone();
  
  public abstract void accept(IClassDefVisitor paramIClassDefVisitor, Object paramObject);
  
  public abstract int add(Attribute_info paramAttribute_info);
  
  public abstract Attribute_info set(int paramInt, Attribute_info paramAttribute_info);
  
  public abstract Attribute_info remove(int paramInt);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IAttributeCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

public abstract interface IClassDefConstants
{
  public static final String INIT_NAME = "<init>";
  public static final String CLINIT_NAME = "<clinit>";
  public static final String CLINIT_DESCRIPTOR = "()V";
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IClassDefConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

public abstract interface IClassDefVisitor
{
  public abstract Object visit(ClassDef paramClassDef, Object paramObject);
  
  public abstract Object visit(IConstantCollection paramIConstantCollection, Object paramObject);
  
  public abstract Object visit(IInterfaceCollection paramIInterfaceCollection, Object paramObject);
  
  public abstract Object visit(IFieldCollection paramIFieldCollection, Object paramObject);
  
  public abstract Object visit(IMethodCollection paramIMethodCollection, Object paramObject);
  
  public abstract Object visit(IAttributeCollection paramIAttributeCollection, Object paramObject);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IClassDefVisitor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.constant.CONSTANT_info;

public abstract interface IConstantCollection$IConstantComparator
{
  public abstract boolean equals(CONSTANT_info paramCONSTANT_info);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IConstantCollection.IConstantComparator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.constant.CONSTANT_info;

public abstract interface IConstantCollection$IConstantIterator
{
  public abstract int nextIndex();
  
  public abstract CONSTANT_info nextConstant();
  
  public abstract CONSTANT_info set(CONSTANT_info paramCONSTANT_info);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IConstantCollection.IConstantIterator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.constant.CONSTANT_info;
import com.vladium.jcd.compiler.IClassFormatOutput;

public abstract interface IConstantCollection
  extends Cloneable, IClassFormatOutput
{
  public abstract CONSTANT_info get(int paramInt);
  
  public abstract IConstantIterator iterator();
  
  public abstract int find(int paramInt, IConstantComparator paramIConstantComparator);
  
  public abstract int findCONSTANT_Utf8(String paramString);
  
  public abstract int size();
  
  public abstract Object clone();
  
  public abstract void accept(IClassDefVisitor paramIClassDefVisitor, Object paramObject);
  
  public abstract int add(CONSTANT_info paramCONSTANT_info);
  
  public abstract CONSTANT_info set(int paramInt, CONSTANT_info paramCONSTANT_info);
  
  public static abstract interface IConstantComparator
  {
    public abstract boolean equals(CONSTANT_info paramCONSTANT_info);
  }
  
  public static abstract interface IConstantIterator
  {
    public abstract int nextIndex();
    
    public abstract CONSTANT_info nextConstant();
    
    public abstract CONSTANT_info set(CONSTANT_info paramCONSTANT_info);
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IConstantCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.compiler.IClassFormatOutput;

public abstract interface IFieldCollection
  extends Cloneable, IClassFormatOutput
{
  public abstract Field_info get(int paramInt);
  
  public abstract int[] get(ClassDef paramClassDef, String paramString);
  
  public abstract int size();
  
  public abstract Object clone();
  
  public abstract void accept(IClassDefVisitor paramIClassDefVisitor, Object paramObject);
  
  public abstract int add(Field_info paramField_info);
  
  public abstract Field_info set(int paramInt, Field_info paramField_info);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IFieldCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.compiler.IClassFormatOutput;

public abstract interface IInterfaceCollection
  extends Cloneable, IClassFormatOutput
{
  public abstract int get(int paramInt);
  
  public abstract int size();
  
  public abstract Object clone();
  
  public abstract void accept(IClassDefVisitor paramIClassDefVisitor, Object paramObject);
  
  public abstract int add(int paramInt);
  
  public abstract int set(int paramInt1, int paramInt2);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IInterfaceCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.compiler.IClassFormatOutput;

public abstract interface IMethodCollection
  extends Cloneable, IClassFormatOutput
{
  public abstract Method_info get(int paramInt);
  
  public abstract int[] get(ClassDef paramClassDef, String paramString);
  
  public abstract int size();
  
  public abstract Object clone();
  
  public abstract void accept(IClassDefVisitor paramIClassDefVisitor, Object paramObject);
  
  public abstract int add(Method_info paramMethod_info);
  
  public abstract Method_info set(int paramInt, Method_info paramMethod_info);
  
  public abstract Method_info remove(int paramInt);
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.IMethodCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.lib.UDataOutputStream;
import com.vladium.util.IntVector;
import java.io.IOException;

final class InterfaceCollection
  implements IInterfaceCollection
{
  private IntVector m_interfaces;
  
  public int get(int offset)
  {
    return m_interfaces.get(offset);
  }
  
  public int size()
  {
    return m_interfaces.size();
  }
  
  public Object clone()
  {
    try
    {
      InterfaceCollection _clone = (InterfaceCollection)super.clone();
      
      m_interfaces = ((IntVector)m_interfaces.clone());
      
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    int _interfaces_count = m_interfaces.size();
    out.writeU2(_interfaces_count);
    for (int i = 0; i < _interfaces_count; i++) {
      out.writeU2(get(i));
    }
  }
  
  public void accept(IClassDefVisitor visitor, Object ctx)
  {
    visitor.visit(this, ctx);
  }
  
  public int add(int interface_index)
  {
    int newoffset = m_interfaces.size();
    m_interfaces.add(interface_index);
    
    return newoffset;
  }
  
  public int set(int offset, int interface_index)
  {
    return m_interfaces.set(offset, interface_index);
  }
  
  InterfaceCollection(int capacity)
  {
    m_interfaces = (capacity < 0 ? new IntVector() : new IntVector(capacity));
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.InterfaceCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.lib.UDataOutputStream;
import com.vladium.util.IntVector;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

final class MethodCollection
  implements IMethodCollection
{
  private List m_methods;
  
  public Method_info get(int offset)
  {
    return (Method_info)m_methods.get(offset);
  }
  
  public int[] get(ClassDef cls, String name)
  {
    if (cls == null) {
      throw new IllegalArgumentException("null input: cls");
    }
    int count = m_methods.size();
    IntVector result = new IntVector(count);
    for (int m = 0; m < count; m++)
    {
      Method_info method = (Method_info)m_methods.get(m);
      if (method.getName(cls).equals(name)) {
        result.add(m);
      }
    }
    return result.values();
  }
  
  public int size()
  {
    return m_methods.size();
  }
  
  public Object clone()
  {
    try
    {
      MethodCollection _clone = (MethodCollection)super.clone();
      
      int methods_count = m_methods.size();
      m_methods = new ArrayList(methods_count);
      for (int m = 0; m < methods_count; m++) {
        m_methods.add(((Method_info)m_methods.get(m)).clone());
      }
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    int methods_count = m_methods.size();
    out.writeU2(methods_count);
    for (int i = 0; i < methods_count; i++) {
      get(i).writeInClassFormat(out);
    }
  }
  
  public void accept(IClassDefVisitor visitor, Object ctx)
  {
    visitor.visit(this, ctx);
  }
  
  public int add(Method_info method)
  {
    int newoffset = m_methods.size();
    m_methods.add(method);
    
    return newoffset;
  }
  
  public Method_info set(int offset, Method_info method)
  {
    return (Method_info)m_methods.set(offset, method);
  }
  
  public Method_info remove(int offset)
  {
    return (Method_info)m_methods.remove(offset);
  }
  
  MethodCollection(int capacity)
  {
    m_methods = (capacity < 0 ? new ArrayList() : new ArrayList(capacity));
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.MethodCollection
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls;

import com.vladium.jcd.cls.attribute.Attribute_info;
import com.vladium.jcd.cls.constant.CONSTANT_Utf8_info;
import com.vladium.jcd.lib.UDataInputStream;
import com.vladium.jcd.lib.UDataOutputStream;
import java.io.IOException;

public final class Method_info
  implements Cloneable, IAccessFlags
{
  public int m_name_index;
  public int m_descriptor_index;
  private int m_access_flags;
  private IAttributeCollection m_attributes;
  
  public Method_info(int access_flags, int name_index, int descriptor_index, IAttributeCollection attributes)
  {
    m_access_flags = access_flags;
    
    m_name_index = name_index;
    m_descriptor_index = descriptor_index;
    
    m_attributes = attributes;
  }
  
  public Method_info(IConstantCollection constants, UDataInputStream bytes)
    throws IOException
  {
    m_access_flags = bytes.readU2();
    
    m_name_index = bytes.readU2();
    m_descriptor_index = bytes.readU2();
    
    int attributes_count = bytes.readU2();
    m_attributes = ElementFactory.newAttributeCollection(attributes_count);
    for (int i = 0; i < attributes_count; i++)
    {
      Attribute_info attribute_info = Attribute_info.new_Attribute_info(constants, bytes);
      
      m_attributes.add(attribute_info);
    }
  }
  
  public String getName(ClassDef cls)
  {
    return getConstantsgetm_name_index)).m_value;
  }
  
  public String getDescriptor(ClassDef cls)
  {
    return getConstantsgetm_descriptor_index)).m_value;
  }
  
  public boolean isNative()
  {
    return (m_access_flags & 0x100) != 0;
  }
  
  public boolean isAbstract()
  {
    return (m_access_flags & 0x400) != 0;
  }
  
  public boolean isSynthetic()
  {
    return m_attributes.hasSynthetic();
  }
  
  public boolean isBridge()
  {
    return ((m_access_flags & 0x40) != 0) || (m_attributes.hasBridge());
  }
  
  public final void setAccessFlags(int flags)
  {
    m_access_flags = flags;
  }
  
  public final int getAccessFlags()
  {
    return m_access_flags;
  }
  
  public IAttributeCollection getAttributes()
  {
    return m_attributes;
  }
  
  public String toString()
  {
    StringBuffer s = new StringBuffer();
    
    s.append("method_info: [modifiers: 0x" + Integer.toHexString(m_access_flags) + ", name_index = " + m_name_index + ", descriptor_index = " + m_descriptor_index + "]\n");
    for (int i = 0; i < m_attributes.size(); i++)
    {
      Attribute_info attribute_info = m_attributes.get(i);
      
      s.append("\t[" + i + "] attribute: " + attribute_info + "\n");
    }
    return s.toString();
  }
  
  public Object clone()
  {
    try
    {
      Method_info _clone = (Method_info)super.clone();
      
      m_attributes = ((IAttributeCollection)m_attributes.clone());
      
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public void writeInClassFormat(UDataOutputStream out)
    throws IOException
  {
    out.writeU2(m_access_flags);
    
    out.writeU2(m_name_index);
    out.writeU2(m_descriptor_index);
    
    m_attributes.writeInClassFormat(out);
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.Method_info
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls.attribute;

public abstract class AttributeElementFactory
{
  public static IExceptionHandlerTable newExceptionHandlerTable(int capacity)
  {
    return new ExceptionHandlerTable(capacity);
  }
}

/* Location:
 * Qualified Name:     com.vladium.jcd.cls.attribute.AttributeElementFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.jcd.cls.attribute;

import com.vladium.jcd.cls.ClassDef;
import com.vladium.jcd.cls.IConstantCollection;
import com.vladium.jcd.cls.constant.CONSTANT_Utf8_info;
import com.vladium.jcd.compiler.IClassFormatOutput;
import com.vladium.jcd.lib.UDataInputStream;
import com.vladium.jcd.lib.UDataOutputStream;
import java.io.IOException;

public abstract class Attribute_info
  implements Cloneable, IClassFormatOutput
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

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