org.eclipse.equinox.p2.repository.tools_2.0.100.v20110815-1438

mode));
        }
      }
    }
    buffer.append(Messages.disassembler_opentypedeclaration);
    disassembleTypeMembers(classFileReader, className, buffer, lineSeparator, 1, mode, isEnum);
    if (checkMode(mode, 1))
    {
      ClassFileAttribute[] attributes = classFileReader.getAttributes();
      int length = attributes.length;
      EnclosingMethodAttribute enclosingMethodAttribute = getEnclosingMethodAttribute(classFileReader);
      int remainingAttributesLength = length;
      if (innerClassesAttribute != null) {
        remainingAttributesLength--;
      }
      if (enclosingMethodAttribute != null) {
        remainingAttributesLength--;
      }
      if (sourceAttribute != null) {
        remainingAttributesLength--;
      }
      if (signatureAttribute != null) {
        remainingAttributesLength--;
      }
      if ((innerClassesAttribute != null) || (enclosingMethodAttribute != null) || (remainingAttributesLength != 0)) {
        writeNewLine(buffer, lineSeparator, 0);
      }
      if (innerClassesAttribute != null) {
        disassemble(innerClassesAttribute, buffer, lineSeparator, 1);
      }
      if (enclosingMethodAttribute != null) {
        disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0);
      }
      if (runtimeVisibleAnnotationsAttribute != null) {
        disassemble((RuntimeVisibleAnnotationsAttribute)runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
      }
      if (runtimeInvisibleAnnotationsAttribute != null) {
        disassemble((RuntimeInvisibleAnnotationsAttribute)runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
      }
    }
    writeNewLine(buffer, lineSeparator, 0);
    buffer.append(Messages.disassembler_closetypedeclaration);
    return buffer.toString();
  }
  
  private boolean isJavaLangObject(char[] className)
  {
    return Arrays.equals(TypeConstants.JAVA_LANG_OBJECT, CharOperation.splitOn('.', className));
  }
  
  private boolean isVarArgs(MethodInfo methodInfo)
  {
    int accessFlags = methodInfo.getAccessFlags();
    if ((accessFlags & 0x80) != 0) {
      return true;
    }
    return Utility.getAttribute(methodInfo, AttributeNamesConstants.VAR_ARGS) != null;
  }
  
  private void disassemble(CodeAttribute codeAttribute, char[] methodDescriptor, boolean isStatic, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber - 1);
    DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode);
    try
    {
      codeAttribute.traverse(visitor);
    }
    catch (ClassFormatException localClassFormatException)
    {
      dumpTab(tabNumber + 2, buffer);
      buffer.append(Messages.classformat_classformatexception);
      writeNewLine(buffer, lineSeparator, tabNumber + 1);
    }
    int exceptionTableLength = codeAttribute.getExceptionTableLength();
    if (exceptionTableLength != 0)
    {
      int tabNumberForExceptionAttribute = tabNumber + 2;
      dumpTab(tabNumberForExceptionAttribute, buffer);
      ExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable();
      buffer.append(Messages.disassembler_exceptiontableheader);
      writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1);
      for (int i = 0; i < exceptionTableLength; i++)
      {
        if (i != 0) {
          writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1);
        }
        ExceptionTableEntry exceptionTableEntry = exceptionTableEntries[i];
        char[] catchType;
        if (exceptionTableEntry.getCatchTypeIndex() != 0)
        {
          char[] catchType = exceptionTableEntry.getCatchType();
          CharOperation.replace(catchType, '/', '.');
          catchType = returnClassName(catchType, '.', mode);
        }
        else
        {
          catchType = ANY_EXCEPTION;
        }
        buffer.append(NLS.bind(Messages.classfileformat_exceptiontableentry, new String[] { Integer.toString(exceptionTableEntry.getStartPC()), Integer.toString(exceptionTableEntry.getEndPC()), Integer.toString(exceptionTableEntry.getHandlerPC()), new String(catchType) }));
      }
    }
  }
  
  private void disassemble(EnclosingMethodAttribute enclosingMethodAttribute, StringBuffer buffer, String lineSeparator, int tabNumber)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_enclosingmethodheader);
    buffer.append(" ")
      .append(enclosingMethodAttribute.getEnclosingClass());
    if (enclosingMethodAttribute.getMethodNameAndTypeIndex() != 0) {
      buffer.append(".").append(enclosingMethodAttribute.getMethodName()).append(enclosingMethodAttribute.getMethodDescriptor());
    }
  }
  
  private void disassemble(FieldInfo fieldInfo, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber);
    char[] fieldDescriptor = fieldInfo.getDescriptor();
    SignatureAttribute signatureAttribute = (SignatureAttribute)Utility.getAttribute(fieldInfo, AttributeNamesConstants.SIGNATURE);
    if (checkMode(mode, 1))
    {
      buffer.append(NLS.bind(Messages.classfileformat_fieldddescriptor, new String[] { new String(fieldDescriptor) }));
      if (fieldInfo.isDeprecated()) {
        buffer.append(Messages.disassembler_deprecated);
      }
      writeNewLine(buffer, lineSeparator, tabNumber);
      if (signatureAttribute != null)
      {
        buffer.append(NLS.bind(Messages.disassembler_signatureattributeheader, new String(signatureAttribute.getSignature())));
        writeNewLine(buffer, lineSeparator, tabNumber);
      }
    }
    ClassFileAttribute runtimeVisibleAnnotationsAttribute = Utility.getAttribute(fieldInfo, AttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
    ClassFileAttribute runtimeInvisibleAnnotationsAttribute = Utility.getAttribute(fieldInfo, AttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
    if (checkMode(mode, 1))
    {
      if (runtimeInvisibleAnnotationsAttribute != null)
      {
        disassembleAsModifier((RuntimeInvisibleAnnotationsAttribute)runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
        writeNewLine(buffer, lineSeparator, tabNumber);
      }
      if (runtimeVisibleAnnotationsAttribute != null)
      {
        disassembleAsModifier((RuntimeVisibleAnnotationsAttribute)runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
        writeNewLine(buffer, lineSeparator, tabNumber);
      }
    }
    decodeModifiersForField(buffer, fieldInfo.getAccessFlags());
    if (fieldInfo.isSynthetic())
    {
      buffer.append("synthetic");
      buffer.append(Messages.disassembler_space);
    }
    buffer.append(returnClassName(getSignatureForField(fieldDescriptor), '.', mode));
    buffer.append(' ');
    buffer.append(new String(fieldInfo.getName()));
    ConstantValueAttribute constantValueAttribute = fieldInfo.getConstantValueAttribute();
    if (constantValueAttribute != null)
    {
      buffer.append(Messages.disassembler_fieldhasconstant);
      ConstantPoolEntry constantPoolEntry = constantValueAttribute.getConstantValue();
      switch (constantPoolEntry.getKind())
      {
      case 5: 
        buffer.append(constantPoolEntry.getLongValue() + "L");
        break;
      case 4: 
        buffer.append(constantPoolEntry.getFloatValue() + "f");
        break;
      case 6: 
        buffer.append(constantPoolEntry.getDoubleValue());
        break;
      case 3: 
        switch (fieldDescriptor[0])
        {
        case 'C': 
          buffer.append("'" + (char)constantPoolEntry.getIntegerValue() + "'");
          break;
        case 'Z': 
          buffer.append(constantPoolEntry.getIntegerValue() == 1 ? "true" : "false");
          break;
        case 'B': 
          buffer.append(constantPoolEntry.getIntegerValue());
          break;
        case 'S': 
          buffer.append(constantPoolEntry.getIntegerValue());
          break;
        case 'I': 
          buffer.append(constantPoolEntry.getIntegerValue());
        }
        break;
      case 8: 
        buffer.append("\"" + decodeStringValue(constantPoolEntry.getStringValue()) + "\"");
      }
    }
    buffer.append(Messages.disassembler_endoffieldheader);
    if (checkMode(mode, 1))
    {
      if (runtimeVisibleAnnotationsAttribute != null) {
        disassemble((RuntimeVisibleAnnotationsAttribute)runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
      if (runtimeInvisibleAnnotationsAttribute != null) {
        disassemble((RuntimeInvisibleAnnotationsAttribute)runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
    }
  }
  
  private void disassemble(InnerClassesAttribute innerClassesAttribute, StringBuffer buffer, String lineSeparator, int tabNumber)
  {
    writeNewLine(buffer, lineSeparator, tabNumber);
    buffer.append(Messages.disassembler_innerattributesheader);
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    InnerClassesAttributeEntry[] innerClassesAttributeEntries = innerClassesAttribute.getInnerClassAttributesEntries();
    int length = innerClassesAttributeEntries.length;
    if (length > 1)
    {
      final char[] EMPTY_CHAR_ARRAY = "".toCharArray();
      Arrays.sort(innerClassesAttributeEntries, new Comparator()
      {
        public int compare(InnerClassesAttributeEntry o1, InnerClassesAttributeEntry o2)
        {
          char[] innerClassName1 = o1.getInnerClassName();
          char[] innerClassName2 = o2.getInnerClassName();
          char[] innerName1 = o1.getInnerName();
          char[] innerName2 = o2.getInnerName();
          char[] outerClassName1 = o1.getOuterClassName();
          char[] outerClassName2 = o2.getOuterClassName();
          StringBuffer buffer1 = new StringBuffer();
          buffer1.append(innerClassName1 == null ? EMPTY_CHAR_ARRAY : innerClassName1);
          buffer1.append(innerName1 == null ? EMPTY_CHAR_ARRAY : innerName1);
          buffer1.append(outerClassName1 == null ? EMPTY_CHAR_ARRAY : outerClassName1);
          StringBuffer buffer2 = new StringBuffer();
          buffer2.append(innerClassName2 == null ? EMPTY_CHAR_ARRAY : innerClassName2);
          buffer2.append(innerName2 == null ? EMPTY_CHAR_ARRAY : innerName2);
          buffer2.append(outerClassName2 == null ? EMPTY_CHAR_ARRAY : outerClassName2);
          return buffer1.toString().compareTo(buffer2.toString());
        }
      });
    }
    for (int i = 0; i < length; i++)
    {
      if (i != 0)
      {
        buffer.append(Messages.disassembler_comma);
        writeNewLine(buffer, lineSeparator, tabNumber + 1);
      }
      InnerClassesAttributeEntry innerClassesAttributeEntry = innerClassesAttributeEntries[i];
      int innerClassNameIndex = innerClassesAttributeEntry.getInnerClassNameIndex();
      int outerClassNameIndex = innerClassesAttributeEntry.getOuterClassNameIndex();
      int innerNameIndex = innerClassesAttributeEntry.getInnerNameIndex();
      int accessFlags = innerClassesAttributeEntry.getAccessFlags();
      buffer.append(Messages.disassembler_openinnerclassentry).append(Messages.disassembler_inner_class_info_name);
      if (innerClassNameIndex != 0) {
        buffer.append(Messages.disassembler_space).append(innerClassesAttributeEntry.getInnerClassName());
      }
      buffer.append(Messages.disassembler_comma).append(Messages.disassembler_space).append(Messages.disassembler_outer_class_info_name);
      if (outerClassNameIndex != 0) {
        buffer.append(Messages.disassembler_space).append(innerClassesAttributeEntry.getOuterClassName());
      }
      writeNewLine(buffer, lineSeparator, tabNumber);
      dumpTab(tabNumber, buffer);
      buffer.append(Messages.disassembler_space);
      buffer.append(Messages.disassembler_inner_name);
      if (innerNameIndex != 0) {
        buffer.append(Messages.disassembler_space).append(innerClassesAttributeEntry.getInnerName());
      }
      buffer.append(Messages.disassembler_comma).append(Messages.disassembler_space).append(Messages.disassembler_inner_accessflags).append(accessFlags).append(Messages.disassembler_space);
      decodeModifiersForInnerClasses(buffer, accessFlags, true);
      buffer.append(Messages.disassembler_closeinnerclassentry);
    }
  }
  
  private void disassemble(int index, ParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    Annotation[] annotations = parameterAnnotation.getAnnotations();
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(NLS.bind(Messages.disassembler_parameterannotationentrystart, new String[] { Integer.toString(index), Integer.toString(annotations.length) }));
    int i = 0;
    for (int max = annotations.length; i < max; i++) {
      disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassemble(RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_runtimeinvisibleannotationsattributeheader);
    Annotation[] annotations = runtimeInvisibleAnnotationsAttribute.getAnnotations();
    int i = 0;
    for (int max = annotations.length; i < max; i++) {
      disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassemble(RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_runtimeinvisibleparameterannotationsattributeheader);
    ParameterAnnotation[] parameterAnnotations = runtimeInvisibleParameterAnnotationsAttribute.getParameterAnnotations();
    int i = 0;
    for (int max = parameterAnnotations.length; i < max; i++) {
      disassemble(i, parameterAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassemble(RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_runtimevisibleannotationsattributeheader);
    Annotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations();
    int i = 0;
    for (int max = annotations.length; i < max; i++) {
      disassemble(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassemble(RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_runtimevisibleparameterannotationsattributeheader);
    ParameterAnnotation[] parameterAnnotations = runtimeVisibleParameterAnnotationsAttribute.getParameterAnnotations();
    int i = 0;
    for (int max = parameterAnnotations.length; i < max; i++) {
      disassemble(i, parameterAnnotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleAsModifier(Annotation annotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    char[] typeName = CharOperation.replaceOnCopy(annotation.getTypeName(), '/', '.');
    buffer.append('@').append(returnClassName(Signature.toCharArray(typeName), '.', mode));
    AnnotationComponent[] components = annotation.getComponents();
    int length = components.length;
    if (length != 0)
    {
      buffer.append('(');
      for (int i = 0; i < length; i++)
      {
        if (i > 0)
        {
          buffer.append(',');
          writeNewLine(buffer, lineSeparator, tabNumber);
        }
        disassembleAsModifier(components[i], buffer, lineSeparator, tabNumber + 1, mode);
      }
      buffer.append(')');
    }
  }
  
  private void disassembleAsModifier(AnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    buffer.append(annotationComponent.getComponentName()).append('=');
    disassembleAsModifier(annotationComponent.getComponentValue(), buffer, lineSeparator, tabNumber + 1, mode);
  }
  
  private void disassembleAsModifier(AnnotationComponentValue annotationComponentValue, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    switch (annotationComponentValue.getTag())
    {
    case 66: 
    case 67: 
    case 68: 
    case 70: 
    case 73: 
    case 74: 
    case 83: 
    case 90: 
    case 115: 
      ConstantPoolEntry constantPoolEntry = annotationComponentValue.getConstantValue();
      String value = null;
      switch (constantPoolEntry.getKind())
      {
      case 5: 
        value = constantPoolEntry.getLongValue() + "L";
        break;
      case 4: 
        value = constantPoolEntry.getFloatValue() + "f";
        break;
      case 6: 
        value = Double.toString(constantPoolEntry.getDoubleValue());
        break;
      case 3: 
        switch (annotationComponentValue.getTag())
        {
        case 67: 
          value = "'" + (char)constantPoolEntry.getIntegerValue() + "'";
          break;
        case 90: 
          value = constantPoolEntry.getIntegerValue() == 1 ? "true" : "false";
          break;
        case 66: 
          value = "(byte) " + constantPoolEntry.getIntegerValue();
          break;
        case 83: 
          value = "(short) " + constantPoolEntry.getIntegerValue();
          break;
        case 73: 
          value = "(int) " + constantPoolEntry.getIntegerValue();
        }
        break;
      case 1: 
        value = "\"" + decodeStringValue(constantPoolEntry.getUtf8Value()) + "\"";
      }
      buffer.append(value);
      break;
    case 101: 
      char[] typeName = CharOperation.replaceOnCopy(annotationComponentValue.getEnumConstantTypeName(), '/', '.');
      char[] constantName = annotationComponentValue.getEnumConstantName();
      buffer.append(returnClassName(Signature.toCharArray(typeName), '.', mode)).append('.').append(constantName);
      break;
    case 99: 
      ConstantPoolEntry constantPoolEntry = annotationComponentValue.getClassInfo();
      char[] className = CharOperation.replaceOnCopy(constantPoolEntry.getUtf8Value(), '/', '.');
      buffer.append(returnClassName(Signature.toCharArray(className), '.', mode));
      break;
    case 64: 
      Annotation annotation = annotationComponentValue.getAnnotationValue();
      disassembleAsModifier(annotation, buffer, lineSeparator, tabNumber + 1, mode);
      break;
    case 91: 
      AnnotationComponentValue[] annotationComponentValues = annotationComponentValue.getAnnotationComponentValues();
      buffer.append('{');
      int i = 0;
      for (int max = annotationComponentValues.length; i < max; i++)
      {
        if (i > 0) {
          buffer.append(',');
        }
        disassembleAsModifier(annotationComponentValues[i], buffer, lineSeparator, tabNumber + 1, mode);
      }
      buffer.append('}');
    }
  }
  
  private void disassembleAsModifier(AnnotationDefaultAttribute annotationDefaultAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    AnnotationComponentValue componentValue = annotationDefaultAttribute.getMemberValue();
    disassembleAsModifier(componentValue, buffer, lineSeparator, tabNumber + 1, mode);
  }
  
  private void disassembleAsModifier(RuntimeInvisibleAnnotationsAttribute runtimeInvisibleAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    Annotation[] annotations = runtimeInvisibleAnnotationsAttribute.getAnnotations();
    int i = 0;
    for (int max = annotations.length; i < max; i++) {
      disassembleAsModifier(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleAsModifier(RuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute, StringBuffer buffer, int index, String lineSeparator, int tabNumber, int mode)
  {
    ParameterAnnotation[] parameterAnnotations = runtimeInvisibleParameterAnnotationsAttribute.getParameterAnnotations();
    if (parameterAnnotations.length > index) {
      disassembleAsModifier(parameterAnnotations[index], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleAsModifier(RuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, int index, String lineSeparator, int tabNumber, int mode)
  {
    ParameterAnnotation[] parameterAnnotations = runtimeVisibleParameterAnnotationsAttribute.getParameterAnnotations();
    if (parameterAnnotations.length > index) {
      disassembleAsModifier(parameterAnnotations[index], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleAsModifier(ParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    Annotation[] annotations = parameterAnnotation.getAnnotations();
    int i = 0;
    for (int max = annotations.length; i < max; i++)
    {
      if (i > 0) {
        buffer.append(' ');
      }
      disassembleAsModifier(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleAsModifier(RuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    Annotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations();
    int i = 0;
    for (int max = annotations.length; i < max; i++)
    {
      if (i > 0) {
        writeNewLine(buffer, lineSeparator, tabNumber);
      }
      disassembleAsModifier(annotations[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
  }
  
  private void disassembleTypeMembers(ClassFileReader classFileReader, char[] className, StringBuffer buffer, String lineSeparator, int tabNumber, int mode, boolean isEnum)
  {
    FieldInfo[] fields = classFileReader.getFieldInfos();
    
    Arrays.sort(fields, new Comparator()
    {
      public int compare(FieldInfo fieldInfo1, FieldInfo fieldInfo2)
      {
        int compare = new String(fieldInfo1.getName()).compareTo(new String(fieldInfo2.getName()));
        if (compare == 0) {
          return new String(fieldInfo1.getDescriptor()).compareTo(new String(fieldInfo2.getDescriptor()));
        }
        return compare;
      }
    });
    int i = 0;
    for (int max = fields.length; i < max; i++)
    {
      writeNewLine(buffer, lineSeparator, tabNumber);
      disassemble(fields[i], buffer, lineSeparator, tabNumber, mode);
    }
    MethodInfo[] methods = classFileReader.getMethodInfos();
    
    Arrays.sort(methods, new Comparator()
    {
      public int compare(MethodInfo methodInfo1, MethodInfo methodInfo2)
      {
        int compare = new String(methodInfo1.getName()).compareTo(new String(methodInfo2.getName()));
        if (compare == 0) {
          return new String(methodInfo1.getDescriptor()).compareTo(new String(methodInfo2.getDescriptor()));
        }
        return compare;
      }
    });
    int i = 0;
    for (int max = methods.length; i < max; i++)
    {
      writeNewLine(buffer, lineSeparator, tabNumber);
      disassemble(classFileReader, className, methods[i], buffer, lineSeparator, tabNumber, mode);
    }
  }
  
  private final void dumpTab(int tabNumber, StringBuffer buffer)
  {
    for (int i = 0; i < tabNumber; i++) {
      buffer.append(Messages.disassembler_indentation);
    }
  }
  
  private EnclosingMethodAttribute getEnclosingMethodAttribute(ClassFileReader classFileReader)
  {
    ClassFileAttribute[] attributes = classFileReader.getAttributes();
    int i = 0;
    for (int max = attributes.length; i < max; i++) {
      if (Arrays.equals(attributes[i].getAttributeName(), AttributeNamesConstants.ENCLOSING_METHOD)) {
        return (EnclosingMethodAttribute)attributes[i];
      }
    }
    return null;
  }
  
  private char[] getSignatureForField(char[] fieldDescriptor)
  {
    char[] newFieldDescriptor = CharOperation.replaceOnCopy(fieldDescriptor, '/', '.');
    newFieldDescriptor = CharOperation.replaceOnCopy(newFieldDescriptor, '$', '%');
    char[] fieldDescriptorSignature = Signature.toCharArray(newFieldDescriptor);
    CharOperation.replace(fieldDescriptorSignature, '%', '$');
    return fieldDescriptorSignature;
  }
  
  private boolean isDeprecated(ClassFileReader classFileReader)
  {
    ClassFileAttribute[] attributes = classFileReader.getAttributes();
    int i = 0;
    for (int max = attributes.length; i < max; i++) {
      if (Arrays.equals(attributes[i].getAttributeName(), AttributeNamesConstants.DEPRECATED)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean isSynthetic(ClassFileReader classFileReader)
  {
    int flags = classFileReader.getAccessFlags();
    if ((flags & 0x1000) != 0) {
      return true;
    }
    ClassFileAttribute[] attributes = classFileReader.getAttributes();
    int i = 0;
    for (int max = attributes.length; i < max; i++) {
      if (Arrays.equals(attributes[i].getAttributeName(), AttributeNamesConstants.SYNTHETIC)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean checkMode(int mode, int flag)
  {
    return (mode & flag) != 0;
  }
  
  private boolean isCompact(int mode)
  {
    return (mode & 0x8) != 0;
  }
  
  private char[] returnClassName(char[] classInfoName, char separator, int mode)
  {
    if (classInfoName.length == 0) {
      return CharOperation.NO_CHAR;
    }
    if (isCompact(mode))
    {
      int lastIndexOfSlash = CharOperation.lastIndexOf(separator, classInfoName);
      if (lastIndexOfSlash != -1) {
        return CharOperation.subarray(classInfoName, lastIndexOfSlash + 1, classInfoName.length);
      }
    }
    return classInfoName;
  }
  
  private void writeNewLine(StringBuffer buffer, String lineSeparator, int tabNumber)
  {
    buffer.append(lineSeparator);
    dumpTab(tabNumber, buffer);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.Disassembler
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

public class EnclosingMethodAttribute
  extends ClassFileAttribute
{
  private int enclosingClassIndex;
  private char[] enclosingClassName;
  private int methodDescriptorIndex;
  private char[] methodDescriptor;
  private int methodNameIndex;
  private char[] methodName;
  private int methodNameAndTypeIndex;
  
  EnclosingMethodAttribute(byte[] classFileBytes, ConstantPool constantPool, int offset)
    throws ClassFormatException
  {
    super(classFileBytes, constantPool, offset);
    int index = u2At(classFileBytes, 6, offset);
    enclosingClassIndex = index;
    ConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
    if (constantPoolEntry.getKind() != 7) {
      throw new ClassFormatException(3);
    }
    enclosingClassName = constantPoolEntry.getClassInfoName();
    methodNameAndTypeIndex = u2At(classFileBytes, 8, offset);
    if (methodNameAndTypeIndex != 0)
    {
      constantPoolEntry = constantPool.decodeEntry(methodNameAndTypeIndex);
      if (constantPoolEntry.getKind() != 12) {
        throw new ClassFormatException(3);
      }
      methodDescriptorIndex = constantPoolEntry.getNameAndTypeInfoDescriptorIndex();
      methodNameIndex = constantPoolEntry.getNameAndTypeInfoNameIndex();
      constantPoolEntry = constantPool.decodeEntry(methodDescriptorIndex);
      if (constantPoolEntry.getKind() != 1) {
        throw new ClassFormatException(3);
      }
      methodDescriptor = constantPoolEntry.getUtf8Value();
      constantPoolEntry = constantPool.decodeEntry(methodNameIndex);
      if (constantPoolEntry.getKind() != 1) {
        throw new ClassFormatException(3);
      }
      methodName = constantPoolEntry.getUtf8Value();
    }
  }
  
  public char[] getEnclosingClass()
  {
    return enclosingClassName;
  }
  
  public int getEnclosingClassIndex()
  {
    return enclosingClassIndex;
  }
  
  public char[] getMethodDescriptor()
  {
    return methodDescriptor;
  }
  
  public int getMethodDescriptorIndex()
  {
    return methodDescriptorIndex;
  }
  
  public char[] getMethodName()
  {
    return methodName;
  }
  
  public int getMethodNameIndex()
  {
    return methodNameIndex;
  }
  
  public int getMethodNameAndTypeIndex()
  {
    return methodNameAndTypeIndex;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.EnclosingMethodAttribute
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

public class ExceptionAttribute
  extends ClassFileAttribute
{
  private int exceptionsNumber;
  private char[][] exceptionNames;
  private int[] exceptionIndexes;
  
  ExceptionAttribute(byte[] classFileBytes, ConstantPool constantPool, int offset)
    throws ClassFormatException
  {
    super(classFileBytes, constantPool, offset);
    exceptionsNumber = u2At(classFileBytes, 6, offset);
    int exceptionLength = exceptionsNumber;
    exceptionNames = CharOperation.NO_CHAR_CHAR;
    exceptionIndexes = Utility.EMPTY_INT_ARRAY;
    if (exceptionLength != 0)
    {
      exceptionNames = new char[exceptionLength][];
      exceptionIndexes = new int[exceptionLength];
    }
    int readOffset = 8;
    for (int i = 0; i < exceptionLength; i++)
    {
      exceptionIndexes[i] = u2At(classFileBytes, readOffset, offset);
      ConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(exceptionIndexes[i]);
      if (constantPoolEntry.getKind() != 7) {
        throw new ClassFormatException(3);
      }
      exceptionNames[i] = constantPoolEntry.getClassInfoName();
      readOffset += 2;
    }
  }
  
  public int[] getExceptionIndexes()
  {
    return exceptionIndexes;
  }
  
  public char[][] getExceptionNames()
  {
    return exceptionNames;
  }
  
  public int getExceptionsNumber()
  {
    return exceptionsNumber;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.ExceptionAttribute
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

public class ExceptionTableEntry
  extends ClassFileStruct
{
  private int startPC;
  private int endPC;
  private int handlerPC;
  private int catchTypeIndex;
  private char[] catchType;
  
  ExceptionTableEntry(byte[] classFileBytes, ConstantPool constantPool, int offset)
    throws ClassFormatException
  {
    startPC = u2At(classFileBytes, 0, offset);
    endPC = u2At(classFileBytes, 2, offset);
    handlerPC = u2At(classFileBytes, 4, offset);
    catchTypeIndex = u2At(classFileBytes, 6, offset);
    if (catchTypeIndex != 0)
    {
      ConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(catchTypeIndex);
      if (constantPoolEntry.getKind() != 7) {
        throw new ClassFormatException(3);
      }
      catchType = constantPoolEntry.getClassInfoName();
    }
  }
  
  public int getStartPC()
  {
    return startPC;
  }
  
  public int getEndPC()
  {
    return endPC;
  }
  
  public int getHandlerPC()
  {
    return handlerPC;
  }
  
  public int getCatchTypeIndex()
  {
    return catchTypeIndex;
  }
  
  public char[] getCatchType()
  {
    return catchType;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.ExceptionTableEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

import java.util.Arrays;

public class FieldInfo
  extends ClassFileStruct
{
  private int accessFlags;
  private int attributeBytes;
  private ClassFileAttribute[] attributes;
  private int attributesCount;
  private ConstantValueAttribute constantValueAttribute;
  private char[] descriptor;
  private int descriptorIndex;
  private boolean isDeprecated;
  private boolean isSynthetic;
  private char[] name;
  private int nameIndex;
  
  public FieldInfo(byte[] classFileBytes, ConstantPool constantPool, int offset)
    throws ClassFormatException
  {
    int flags = u2At(classFileBytes, 0, offset);
    accessFlags = flags;
    if ((flags & 0x1000) != 0) {
      isSynthetic = true;
    }
    nameIndex = u2At(classFileBytes, 2, offset);
    ConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(nameIndex);
    if (constantPoolEntry.getKind() != 1) {
      throw new ClassFormatException(3);
    }
    name = constantPoolEntry.getUtf8Value();
    
    descriptorIndex = u2At(classFileBytes, 4, offset);
    constantPoolEntry = constantPool.decodeEntry(descriptorIndex);
    if (constantPoolEntry.getKind() != 1) {
      throw new ClassFormatException(3);
    }
    descriptor = constantPoolEntry.getUtf8Value();
    
    attributesCount = u2At(classFileBytes, 6, offset);
    attributes = ClassFileAttribute.NO_ATTRIBUTES;
    int readOffset = 8;
    if (attributesCount != 0) {
      attributes = new ClassFileAttribute[attributesCount];
    }
    int attributesIndex = 0;
    for (int i = 0; i < attributesCount; i++)
    {
      constantPoolEntry = constantPool.decodeEntry(u2At(classFileBytes, readOffset, offset));
      if (constantPoolEntry.getKind() != 1) {
        throw new ClassFormatException(3);
      }
      char[] attributeName = constantPoolEntry.getUtf8Value();
      if (Arrays.equals(attributeName, AttributeNamesConstants.DEPRECATED))
      {
        isDeprecated = true;
        attributes[(attributesIndex++)] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      else if (Arrays.equals(attributeName, AttributeNamesConstants.SYNTHETIC))
      {
        isSynthetic = true;
        attributes[(attributesIndex++)] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      else if (Arrays.equals(attributeName, AttributeNamesConstants.CONSTANT_VALUE))
      {
        constantValueAttribute = new ConstantValueAttribute(classFileBytes, constantPool, offset + readOffset);
        attributes[(attributesIndex++)] = constantValueAttribute;
      }
      else if (Arrays.equals(attributeName, AttributeNamesConstants.SIGNATURE))
      {
        attributes[(attributesIndex++)] = new SignatureAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      else if (Arrays.equals(attributeName, AttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS))
      {
        attributes[(attributesIndex++)] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      else if (Arrays.equals(attributeName, AttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS))
      {
        attributes[(attributesIndex++)] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      else
      {
        attributes[(attributesIndex++)] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
      }
      readOffset = (int)(readOffset + (6L + u4At(classFileBytes, readOffset + 2, offset)));
    }
    attributeBytes = readOffset;
  }
  
  public int getAccessFlags()
  {
    return accessFlags;
  }
  
  public int getAttributeCount()
  {
    return attributesCount;
  }
  
  public ClassFileAttribute[] getAttributes()
  {
    return attributes;
  }
  
  public ConstantValueAttribute getConstantValueAttribute()
  {
    return constantValueAttribute;
  }
  
  public char[] getDescriptor()
  {
    return descriptor;
  }
  
  public int getDescriptorIndex()
  {
    return descriptorIndex;
  }
  
  public char[] getName()
  {
    return name;
  }
  
  public int getNameIndex()
  {
    return nameIndex;
  }
  
  public boolean hasConstantValueAttribute()
  {
    return constantValueAttribute != null;
  }
  
  public boolean isDeprecated()
  {
    return isDeprecated;
  }
  
  public boolean isSynthetic()
  {
    return isSynthetic;
  }
  
  int sizeInBytes()
  {
    return attributeBytes;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.FieldInfo
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

public abstract interface IModifierConstants
{
  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_SUPER = 32;
  public static final int ACC_SYNCHRONIZED = 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_VARARGS = 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 ACC_STRICT = 2048;
  public static final int ACC_SYNTHETIC = 4096;
  public static final int ACC_ANNOTATION = 8192;
  public static final int ACC_ENUM = 16384;
  public static final String VERSION_1_1 = "1.1";
  public static final String VERSION_1_2 = "1.2";
  public static final String VERSION_1_3 = "1.3";
  public static final String VERSION_1_4 = "1.4";
  public static final String VERSION_1_5 = "1.5";
  public static final String VERSION_1_6 = "1.6";
  public static final String VERSION_1_7 = "1.7";
  public static final String VERSION_CLDC_1_1 = "cldc1.1";
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.IModifierConstants
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.comparator.java;

public abstract interface IOpcodeMnemonics
{
  public static final int NOP = 0;
  public static final int ACONST_NULL = 1;
  public static final int ICONST_M1 = 2;
  public static final int ICONST_0 = 3;
  public static final int ICONST_1 = 4;
  public static final int ICONST_2 = 5;
  public static final int ICONST_3 = 6;
  public static final int ICONST_4 = 7;
  public static final int ICONST_5 = 8;
  public static final int LCONST_0 = 9;
  public static final int LCONST_1 = 10;
  public static final int FCONST_0 = 11;
  public static final int FCONST_1 = 12;
  public static final int FCONST_2 = 13;
  public static final int DCONST_0 = 14;
  public static final int DCONST_1 = 15;
  public static final int BIPUSH = 16;
  public static final int SIPUSH = 17;
  public static final int LDC = 18;
  public static final int LDC_W = 19;
  public static final int LDC2_W = 20;
  public static final int ILOAD = 21;
  public static final int LLOAD = 22;
  public static final int FLOAD = 23;
  public static final int DLOAD = 24;
  public static final int ALOAD = 25;
  public static final int ILOAD_0 = 26;
  public static final int ILOAD_1 = 27;
  public static final int ILOAD_2 = 28;
  public static final int ILOAD_3 = 29;
  public static final int LLOAD_0 = 30;
  public static final int LLOAD_1 = 31;
  public static final int LLOAD_2 = 32;
  public static final int LLOAD_3 = 33;
  public static final int FLOAD_0 = 34;
  public static final int FLOAD_1 = 35;
  public static final int FLOAD_2 = 36;
  public static final int FLOAD_3 = 37;
  public static final int DLOAD_0 = 38;
  public static final int DLOAD_1 = 39;
  public static final int DLOAD_2 = 40;
  public static final int DLOAD_3 = 41;
  public static final int ALOAD_0 = 42;
  public static final int ALOAD_1 = 43;
  public static final int ALO
1 2 3 4 5 6 7 8 9 10 11 12

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-2019. Infinite Loop Ltd