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

ppend(" default: ")
      .append(defaultoffset + pc);
    writeNewLine();
    for (int i = 0; i < npairs; i++)
    {
      writeExtraTabs(3);
      buffer.append("case ")
        .append(offset_pairs[i][0]).append(": ")
        .append(offset_pairs[i][1] + pc);
      writeNewLine();
    }
  }
  
  public void _lor(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['?']);
    writeNewLine();
  }
  
  public void _lrem(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[113]);
    writeNewLine();
  }
  
  public void _lreturn(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _lshl(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[121]);
    writeNewLine();
  }
  
  public void _lshr(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[123]);
    writeNewLine();
  }
  
  public void _lstore_0(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_store, new String[] { OpcodeStringValues.BYTECODE_NAMES[63], "" }));
    writeNewLine();
  }
  
  public void _lstore_1(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_store, new String[] { OpcodeStringValues.BYTECODE_NAMES[64], "" }));
    writeNewLine();
  }
  
  public void _lstore_2(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_store, new String[] { OpcodeStringValues.BYTECODE_NAMES[65], "" }));
    writeNewLine();
  }
  
  public void _lstore_3(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_store, new String[] { OpcodeStringValues.BYTECODE_NAMES[66], "" }));
    writeNewLine();
  }
  
  public void _lstore(int pc, int index)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_store, new String[] { OpcodeStringValues.BYTECODE_NAMES[55], "" }));
    writeNewLine();
  }
  
  public void _lsub(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[101]);
    writeNewLine();
  }
  
  public void _lushr(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[125]);
    writeNewLine();
  }
  
  public void _lxor(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['?']);
    writeNewLine();
  }
  
  public void _monitorenter(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _monitorexit(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _multianewarray(int pc, int index, int dimensions, ConstantPoolEntry constantClass)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_multianewarray, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], returnConstantClassName(constantClass) }));
    writeNewLine();
  }
  
  public void _new(int pc, int index, ConstantPoolEntry constantClass)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_new, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], returnConstantClassName(constantClass) }));
    writeNewLine();
  }
  
  public void _newarray(int pc, int atype)
  {
    dumpPcNumber(pc);
    switch (atype)
    {
    case 4: 
      buffer.append(NLS.bind(Messages.classformat_newarray_boolean, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 5: 
      buffer.append(NLS.bind(Messages.classformat_newarray_char, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 6: 
      buffer.append(NLS.bind(Messages.classformat_newarray_float, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 7: 
      buffer.append(NLS.bind(Messages.classformat_newarray_double, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 8: 
      buffer.append(NLS.bind(Messages.classformat_newarray_byte, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 9: 
      buffer.append(NLS.bind(Messages.classformat_newarray_short, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 10: 
      buffer.append(NLS.bind(Messages.classformat_newarray_int, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
      break;
    case 11: 
      buffer.append(NLS.bind(Messages.classformat_newarray_long, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], Integer.toString(atype) }));
    }
    writeNewLine();
  }
  
  public void _nop(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[0]);
    writeNewLine();
  }
  
  public void _pop(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[87]);
    writeNewLine();
  }
  
  public void _pop2(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[88]);
    writeNewLine();
  }
  
  public void _putfield(int pc, int index, ConstantPoolEntry constantFieldref)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_putfield, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], returnDeclaringClassName(constantFieldref), new String(constantFieldref.getFieldName()), returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) }));
    writeNewLine();
  }
  
  public void _putstatic(int pc, int index, ConstantPoolEntry constantFieldref)
  {
    dumpPcNumber(pc);
    buffer.append(NLS.bind(Messages.classformat_putstatic, new String[] { OpcodeStringValues.BYTECODE_NAMES['�'], returnDeclaringClassName(constantFieldref), new String(constantFieldref.getFieldName()), returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) }));
    writeNewLine();
  }
  
  public void _ret(int pc, int index)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']).append(Messages.disassembler_space).append(index);
    writeNewLine();
  }
  
  public void _return(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _saload(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[53]);
    writeNewLine();
  }
  
  public void _sastore(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[86]);
    writeNewLine();
  }
  
  public void _sipush(int pc, short value)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[17]).append(Messages.disassembler_space).append(value);
    writeNewLine();
  }
  
  public void _swap(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES[95]);
    writeNewLine();
  }
  
  public void _tableswitch(int pc, int defaultoffset, int low, int high, int[] jump_offsets)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']).append(" default: ")
      .append(defaultoffset + pc);
    writeNewLine();
    for (int i = low; i < high + 1; i++)
    {
      writeExtraTabs(3);
      buffer.append("case ")
        .append(i).append(": ")
        .append(jump_offsets[(i - low)] + pc);
      writeNewLine();
    }
  }
  
  public void _wide(int pc, int iincopcode, int index, int _const)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
    _iinc(pc + 1, index, _const);
  }
  
  public void _wide(int pc, int opcode, int index)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
    switch (opcode)
    {
    case 21: 
      _iload(pc + 1, index);
      break;
    case 23: 
      _fload(pc + 1, index);
      break;
    case 25: 
      _aload(pc + 1, index);
      break;
    case 22: 
      _lload(pc + 1, index);
      break;
    case 24: 
      _dload(pc + 1, index);
      break;
    case 54: 
      _istore(pc + 1, index);
      break;
    case 56: 
      _fstore(pc + 1, index);
      break;
    case 58: 
      _astore(pc + 1, index);
      break;
    case 55: 
      _lstore(pc + 1, index);
      break;
    case 57: 
      _dstore(pc + 1, index);
      break;
    case 169: 
      _ret(pc + 1, index);
    }
  }
  
  public void _breakpoint(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _impdep1(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  public void _impdep2(int pc)
  {
    dumpPcNumber(pc);
    buffer.append(OpcodeStringValues.BYTECODE_NAMES['�']);
    writeNewLine();
  }
  
  private boolean isCompact()
  {
    return (mode & 0x8) != 0;
  }
  
  private String returnConstantClassName(ConstantPoolEntry constantClass)
  {
    char[] className = constantClass.getClassInfoName();
    if (className.length == 0) {
      return "\"\"";
    }
    switch (className[0])
    {
    case '[': 
      StringBuffer classNameBuffer = new StringBuffer();
      Utility.appendTypeSignature(className, 0, classNameBuffer, isCompact());
      return classNameBuffer.toString();
    }
    return returnClassName(className);
  }
  
  private String returnClassName(char[] classInfoName)
  {
    if (classInfoName.length == 0) {
      return "\"\"";
    }
    if (isCompact())
    {
      int lastIndexOfSlash = CharOperation.lastIndexOf('/', classInfoName);
      if (lastIndexOfSlash != -1) {
        return new String(classInfoName, lastIndexOfSlash + 1, classInfoName.length - lastIndexOfSlash - 1);
      }
    }
    CharOperation.replace(classInfoName, '/', '.');
    return new String(classInfoName);
  }
  
  private String returnDeclaringClassName(ConstantPoolEntry constantRef)
  {
    char[] className = constantRef.getClassName();
    return returnClassName(className);
  }
  
  private String returnMethodSignature(ConstantPoolEntry constantMethodref)
  {
    char[] methodDescriptor = constantMethodref.getMethodDescriptor();
    CharOperation.replace(methodDescriptor, '$', '#');
    char[] signature = Utility.toString(constantMethodref.getClassName(), constantMethodref.getMethodName(), methodDescriptor, true, isCompact()).toCharArray();
    CharOperation.replace(signature, '#', '$');
    return String.valueOf(signature);
  }
  
  private void writeNewLine()
  {
    buffer.append(lineSeparator);
  }
  
  private void writeTabs()
  {
    int i = 0;
    for (int max = tabNumber; i < max; i++) {
      buffer.append(Messages.disassembler_indentation);
    }
  }
  
  private void writeExtraTabs(int extraTabs)
  {
    int i = 0;
    for (int max = tabNumber + extraTabs; i < max; i++) {
      buffer.append(Messages.disassembler_indentation);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.DefaultBytecodeVisitor
 * 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.Comparator;

class Disassembler$1
  implements Comparator<InnerClassesAttributeEntry>
{
  final Disassembler this$0;
  
  Disassembler$1(Disassembler paramDisassembler, char[] paramArrayOfChar) {}
  
  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 ? val$EMPTY_CHAR_ARRAY : innerClassName1);
    buffer1.append(innerName1 == null ? val$EMPTY_CHAR_ARRAY : innerName1);
    buffer1.append(outerClassName1 == null ? val$EMPTY_CHAR_ARRAY : outerClassName1);
    StringBuffer buffer2 = new StringBuffer();
    buffer2.append(innerClassName2 == null ? val$EMPTY_CHAR_ARRAY : innerClassName2);
    buffer2.append(innerName2 == null ? val$EMPTY_CHAR_ARRAY : innerName2);
    buffer2.append(outerClassName2 == null ? val$EMPTY_CHAR_ARRAY : outerClassName2);
    return buffer1.toString().compareTo(buffer2.toString());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.Disassembler.1
 * 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.Comparator;

class Disassembler$2
  implements Comparator<FieldInfo>
{
  final Disassembler this$0;
  
  Disassembler$2(Disassembler paramDisassembler) {}
  
  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;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.Disassembler.2
 * 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.Comparator;

class Disassembler$3
  implements Comparator<MethodInfo>
{
  final Disassembler this$0;
  
  Disassembler$3(Disassembler paramDisassembler) {}
  
  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;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.comparator.java.Disassembler.3
 * 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;
import java.util.Comparator;
import org.eclipse.osgi.util.NLS;

public class Disassembler
{
  public static final int DETAILED = 1;
  public static final int COMPACT = 8;
  private static final char[] ANY_EXCEPTION = Messages.classfileformat_anyexceptionhandler.toCharArray();
  private static final String VERSION_UNKNOWN = Messages.classfileformat_versionUnknown;
  
  private boolean appendModifier(StringBuffer buffer, int accessFlags, int modifierConstant, String modifier, boolean firstModifier)
  {
    if ((accessFlags & modifierConstant) != 0)
    {
      if (!firstModifier) {
        buffer.append(Messages.disassembler_space);
      }
      if (firstModifier) {
        firstModifier = false;
      }
      buffer.append(modifier);
    }
    return firstModifier;
  }
  
  private void decodeModifiers(StringBuffer buffer, int accessFlags, int[] checkBits)
  {
    decodeModifiers(buffer, accessFlags, false, false, checkBits);
  }
  
  private void decodeModifiers(StringBuffer buffer, int accessFlags, boolean printDefault, boolean asBridge, int[] checkBits)
  {
    if (checkBits == null) {
      return;
    }
    boolean firstModifier = true;
    int i = 0;
    for (int max = checkBits.length; i < max; i++) {
      switch (checkBits[i])
      {
      case 1: 
        firstModifier = appendModifier(buffer, accessFlags, 1, "public", firstModifier);
        break;
      case 4: 
        firstModifier = appendModifier(buffer, accessFlags, 4, "protected", firstModifier);
        break;
      case 2: 
        firstModifier = appendModifier(buffer, accessFlags, 2, "private", firstModifier);
        break;
      case 1024: 
        firstModifier = appendModifier(buffer, accessFlags, 1024, "abstract", firstModifier);
        break;
      case 8: 
        firstModifier = appendModifier(buffer, accessFlags, 8, "static", firstModifier);
        break;
      case 16: 
        firstModifier = appendModifier(buffer, accessFlags, 16, "final", firstModifier);
        break;
      case 32: 
        firstModifier = appendModifier(buffer, accessFlags, 32, "synchronized", firstModifier);
        break;
      case 256: 
        firstModifier = appendModifier(buffer, accessFlags, 256, "native", firstModifier);
        break;
      case 2048: 
        firstModifier = appendModifier(buffer, accessFlags, 2048, "strictfp", firstModifier);
        break;
      case 128: 
        firstModifier = appendModifier(buffer, accessFlags, 128, "transient", firstModifier);
        break;
      case 64: 
        if (asBridge) {
          firstModifier = appendModifier(buffer, accessFlags, 64, "bridge", firstModifier);
        } else {
          firstModifier = appendModifier(buffer, accessFlags, 64, "volatile", firstModifier);
        }
        break;
      case 16384: 
        firstModifier = appendModifier(buffer, accessFlags, 16384, "enum", firstModifier);
      }
    }
    if (!firstModifier)
    {
      if (!printDefault) {
        buffer.append(Messages.disassembler_space);
      }
    }
    else if (printDefault) {
      buffer.append("default");
    }
  }
  
  private void decodeModifiersForField(StringBuffer buffer, int accessFlags)
  {
    decodeModifiers(buffer, accessFlags, new int[] { 1, 4, 2, 8, 16, 128, 64, 16384 });
  }
  
  private final void decodeModifiersForInnerClasses(StringBuffer buffer, int accessFlags, boolean printDefault)
  {
    decodeModifiers(buffer, accessFlags, printDefault, false, new int[] { 1, 4, 2, 1024, 8, 16 });
  }
  
  private final void decodeModifiersForMethod(StringBuffer buffer, int accessFlags)
  {
    decodeModifiers(buffer, accessFlags, false, true, new int[] { 1, 4, 2, 1024, 8, 16, 32, 256, 2048, 64 });
  }
  
  private final void decodeModifiersForType(StringBuffer buffer, int accessFlags)
  {
    decodeModifiers(buffer, accessFlags, new int[] { 1, 1024, 16 });
  }
  
  public static String escapeString(String s)
  {
    StringBuffer buffer = new StringBuffer();
    int i = 0;
    for (int max = s.length(); i < max; i++)
    {
      char c = s.charAt(i);
      switch (c)
      {
      case '\b': 
        buffer.append("\\b");
        break;
      case '\t': 
        buffer.append("\\t");
        break;
      case '\n': 
        buffer.append("\\n");
        break;
      case '\f': 
        buffer.append("\\f");
        break;
      case '\r': 
        buffer.append("\\r");
        break;
      case '\000': 
        buffer.append("\\0");
        break;
      case '\001': 
        buffer.append("\\1");
        break;
      case '\002': 
        buffer.append("\\2");
        break;
      case '\003': 
        buffer.append("\\3");
        break;
      case '\004': 
        buffer.append("\\4");
        break;
      case '\005': 
        buffer.append("\\5");
        break;
      case '\006': 
        buffer.append("\\6");
        break;
      case '\007': 
        buffer.append("\\7");
        break;
      case '\013': 
      default: 
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
  
  static String decodeStringValue(char[] chars)
  {
    StringBuffer buffer = new StringBuffer();
    int i = 0;
    for (int max = chars.length; i < max; i++)
    {
      char c = chars[i];
      switch (c)
      {
      case '\b': 
        buffer.append("\\b");
        break;
      case '\t': 
        buffer.append("\\t");
        break;
      case '\n': 
        buffer.append("\\n");
        break;
      case '\f': 
        buffer.append("\\f");
        break;
      case '\r': 
        buffer.append("\\r");
        break;
      case '\000': 
        buffer.append("\\0");
        break;
      case '\001': 
        buffer.append("\\1");
        break;
      case '\002': 
        buffer.append("\\2");
        break;
      case '\003': 
        buffer.append("\\3");
        break;
      case '\004': 
        buffer.append("\\4");
        break;
      case '\005': 
        buffer.append("\\5");
        break;
      case '\006': 
        buffer.append("\\6");
        break;
      case '\007': 
        buffer.append("\\7");
        break;
      case '\013': 
      default: 
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
  
  static String decodeStringValue(String s)
  {
    return decodeStringValue(s.toCharArray());
  }
  
  public String disassemble(byte[] classFileBytes, String lineSeparator, int mode)
    throws ClassFormatException
  {
    try
    {
      return disassemble(new ClassFileReader(classFileBytes, 65535), lineSeparator, mode);
    }
    catch (ArrayIndexOutOfBoundsException e)
    {
      throw new ClassFormatException(e.getMessage(), e);
    }
  }
  
  private void disassemble(Annotation annotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    char[] typeName = CharOperation.replaceOnCopy(annotation.getTypeName(), '/', '.');
    buffer.append(NLS.bind(Messages.disassembler_annotationentrystart, new String[] { new String(returnClassName(Signature.toCharArray(typeName), '.', mode)) }));
    AnnotationComponent[] components = annotation.getComponents();
    int i = 0;
    for (int max = components.length; i < max; i++) {
      disassemble(components[i], buffer, lineSeparator, tabNumber + 1, mode);
    }
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_annotationentryend);
  }
  
  private void disassemble(AnnotationComponent annotationComponent, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(NLS.bind(Messages.disassembler_annotationcomponent, new String[] { new String(annotationComponent.getComponentName()) }));
    disassemble(annotationComponent.getComponentValue(), buffer, lineSeparator, tabNumber + 1, mode);
  }
  
  private void disassemble(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(NLS.bind(Messages.disassembler_annotationdefaultvalue, value));
      break;
    case 101: 
      char[] typeName = CharOperation.replaceOnCopy(annotationComponentValue.getEnumConstantTypeName(), '/', '.');
      char[] constantName = annotationComponentValue.getEnumConstantName();
      buffer.append(NLS.bind(Messages.disassembler_annotationenumvalue, new String[] { new String(returnClassName(Signature.toCharArray(typeName), '.', mode)), new String(constantName) }));
      break;
    case 99: 
      ConstantPoolEntry constantPoolEntry = annotationComponentValue.getClassInfo();
      char[] className = CharOperation.replaceOnCopy(constantPoolEntry.getUtf8Value(), '/', '.');
      buffer.append(NLS.bind(Messages.disassembler_annotationclassvalue, new String[] { new String(returnClassName(Signature.toCharArray(className), '.', mode)) }));
      break;
    case 64: 
      buffer.append(Messages.disassembler_annotationannotationvalue);
      Annotation annotation = annotationComponentValue.getAnnotationValue();
      disassemble(annotation, buffer, lineSeparator, tabNumber + 1, mode);
      break;
    case 91: 
      buffer.append(Messages.disassembler_annotationarrayvaluestart);
      AnnotationComponentValue[] annotationComponentValues = annotationComponentValue.getAnnotationComponentValues();
      int i = 0;
      for (int max = annotationComponentValues.length; i < max; i++)
      {
        writeNewLine(buffer, lineSeparator, tabNumber + 1);
        disassemble(annotationComponentValues[i], buffer, lineSeparator, tabNumber + 1, mode);
      }
      writeNewLine(buffer, lineSeparator, tabNumber + 1);
      buffer.append(Messages.disassembler_annotationarrayvalueend);
    }
  }
  
  private void disassemble(AnnotationDefaultAttribute annotationDefaultAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber + 1);
    buffer.append(Messages.disassembler_annotationdefaultheader);
    AnnotationComponentValue componentValue = annotationDefaultAttribute.getMemberValue();
    writeNewLine(buffer, lineSeparator, tabNumber + 2);
    disassemble(componentValue, buffer, lineSeparator, tabNumber + 1, mode);
  }
  
  private void disassemble(ClassFileReader classFileReader, char[] className, MethodInfo methodInfo, StringBuffer buffer, String lineSeparator, int tabNumber, int mode)
  {
    writeNewLine(buffer, lineSeparator, tabNumber);
    CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
    char[] methodDescriptor = methodInfo.getDescriptor();
    SignatureAttribute signatureAttribute = (SignatureAttribute)Utility.getAttribute(methodInfo, AttributeNamesConstants.SIGNATURE);
    ClassFileAttribute runtimeVisibleAnnotationsAttribute = Utility.getAttribute(methodInfo, AttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
    ClassFileAttribute runtimeInvisibleAnnotationsAttribute = Utility.getAttribute(methodInfo, AttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
    ClassFileAttribute runtimeVisibleParameterAnnotationsAttribute = Utility.getAttribute(methodInfo, AttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS);
    ClassFileAttribute runtimeInvisibleParameterAnnotationsAttribute = Utility.getAttribute(methodInfo, AttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS);
    ClassFileAttribute annotationDefaultAttribute = Utility.getAttribute(methodInfo, AttributeNamesConstants.ANNOTATION_DEFAULT);
    if (checkMode(mode, 1))
    {
      buffer.append(NLS.bind(Messages.classfileformat_methoddescriptor, new String[] { new String(methodDescriptor) }));
      if (methodInfo.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);
      }
      if (codeAttribute != null)
      {
        buffer.append(NLS.bind(Messages.classfileformat_stacksAndLocals, new String[] { Integer.toString(codeAttribute.getMaxStack()), Integer.toString(codeAttribute.getMaxLocals()) }));
        writeNewLine(buffer, lineSeparator, tabNumber);
      }
      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);
      }
    }
    int accessFlags = methodInfo.getAccessFlags();
    decodeModifiersForMethod(buffer, accessFlags);
    if (methodInfo.isSynthetic())
    {
      buffer.append("synthetic");
      buffer.append(Messages.disassembler_space);
    }
    CharOperation.replace(methodDescriptor, '/', '.');
    boolean isVarArgs = isVarArgs(methodInfo);
    char[] methodHeader = (char[])null;
    if (methodInfo.isConstructor()) {
      methodHeader = Signature.toCharArray(methodDescriptor, returnClassName(className, '.', 8), null, !checkMode(mode, 8), false, isVarArgs);
    } else if (methodInfo.isClinit()) {
      methodHeader = Messages.classfileformat_clinitname.toCharArray();
    } else {
      methodHeader = Signature.toCharArray(methodDescriptor, methodInfo.getName(), null, !checkMode(mode, 8), true, isVarArgs);
    }
    if ((checkMode(mode, 1)) && ((runtimeInvisibleParameterAnnotationsAttribute != null) || (runtimeVisibleParameterAnnotationsAttribute != null)))
    {
      ParameterAnnotation[] invisibleParameterAnnotations = (ParameterAnnotation[])null;
      ParameterAnnotation[] visibleParameterAnnotations = (ParameterAnnotation[])null;
      int length = -1;
      if (runtimeInvisibleParameterAnnotationsAttribute != null)
      {
        RuntimeInvisibleParameterAnnotationsAttribute attribute = (RuntimeInvisibleParameterAnnotationsAttribute)runtimeInvisibleParameterAnnotationsAttribute;
        invisibleParameterAnnotations = attribute.getParameterAnnotations();
        length = invisibleParameterAnnotations.length;
      }
      if (runtimeVisibleParameterAnnotationsAttribute != null)
      {
        RuntimeVisibleParameterAnnotationsAttribute attribute = (RuntimeVisibleParameterAnnotationsAttribute)runtimeVisibleParameterAnnotationsAttribute;
        visibleParameterAnnotations = attribute.getParameterAnnotations();
        length = visibleParameterAnnotations.length;
      }
      int insertionPosition = CharOperation.indexOf('(', methodHeader) + 1;
      int start = 0;
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append(methodHeader, 0, insertionPosition);
      for (int i = 0; i < length; i++)
      {
        if (i > 0) {
          stringBuffer.append(' ');
        }
        int stringBufferSize = stringBuffer.length();
        if (runtimeVisibleParameterAnnotationsAttribute != null) {
          disassembleAsModifier((RuntimeVisibleParameterAnnotationsAttribute)runtimeVisibleParameterAnnotationsAttribute, stringBuffer, i, lineSeparator, tabNumber, mode);
        }
        if (runtimeInvisibleParameterAnnotationsAttribute != null)
        {
          if (stringBuffer.length() != stringBufferSize)
          {
            stringBuffer.append(' ');
            stringBufferSize = stringBuffer.length();
          }
          disassembleAsModifier((RuntimeInvisibleParameterAnnotationsAttribute)runtimeInvisibleParameterAnnotationsAttribute, stringBuffer, i, lineSeparator, tabNumber, mode);
        }
        if ((i == 0) && (stringBuffer.length() != stringBufferSize)) {
          stringBuffer.append(' ');
        }
        start = insertionPosition;
        insertionPosition = CharOperation.indexOf(',', methodHeader, start + 1) + 1;
        if (insertionPosition == 0) {
          stringBuffer.append(methodHeader, start, methodHeader.length - start);
        } else {
          stringBuffer.append(methodHeader, start, insertionPosition - start);
        }
      }
      buffer.append(stringBuffer);
    }
    else
    {
      buffer.append(methodHeader);
    }
    ExceptionAttribute exceptionAttribute = methodInfo.getExceptionAttribute();
    if (exceptionAttribute != null)
    {
      buffer.append(" throws ");
      char[][] exceptionNames = exceptionAttribute.getExceptionNames();
      int length = exceptionNames.length;
      for (int i = 0; i < length; i++)
      {
        if (i != 0) {
          buffer.append(Messages.disassembler_comma).append(Messages.disassembler_space);
        }
        char[] exceptionName = exceptionNames[i];
        CharOperation.replace(exceptionName, '/', '.');
        buffer.append(returnClassName(exceptionName, '.', mode));
      }
    }
    if ((checkMode(mode, 1)) && 
      (annotationDefaultAttribute != null))
    {
      buffer.append(" default ");
      disassembleAsModifier((AnnotationDefaultAttribute)annotationDefaultAttribute, buffer, lineSeparator, tabNumber, mode);
    }
    buffer.append(Messages.disassembler_endofmethodheader);
    if (checkMode(mode, 1))
    {
      if (codeAttribute != null) {
        disassemble(codeAttribute, methodDescriptor, (accessFlags & 0x8) != 0, buffer, lineSeparator, tabNumber, mode);
      }
      if (annotationDefaultAttribute != null) {
        disassemble((AnnotationDefaultAttribute)annotationDefaultAttribute, buffer, lineSeparator, tabNumber, mode);
      }
      if (runtimeVisibleAnnotationsAttribute != null) {
        disassemble((RuntimeVisibleAnnotationsAttribute)runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
      if (runtimeInvisibleAnnotationsAttribute != null) {
        disassemble((RuntimeInvisibleAnnotationsAttribute)runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
      if (runtimeVisibleParameterAnnotationsAttribute != null) {
        disassemble((RuntimeVisibleParameterAnnotationsAttribute)runtimeVisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
      if (runtimeInvisibleParameterAnnotationsAttribute != null) {
        disassemble((RuntimeInvisibleParameterAnnotationsAttribute)runtimeInvisibleParameterAnnotationsAttribute, buffer, lineSeparator, tabNumber, mode);
      }
    }
  }
  
  private String disassemble(ClassFileReader classFileReader, String lineSeparator, int mode)
  {
    if (classFileReader == null) {
      return "";
    }
    char[] className = classFileReader.getClassName();
    if (className == null) {
      return "";
    }
    className = CharOperation.replaceOnCopy(className, '/', '.');
    int accessFlags = classFileReader.getAccessFlags();
    boolean isEnum = (accessFlags & 0x4000) != 0;
    
    StringBuffer buffer = new StringBuffer();
    SourceFileAttribute sourceAttribute = classFileReader.getSourceFileAttribute();
    ClassFileAttribute classFileAttribute = Utility.getAttribute(classFileReader, AttributeNamesConstants.SIGNATURE);
    SignatureAttribute signatureAttribute = (SignatureAttribute)classFileAttribute;
    if (checkMode(mode, 1))
    {
      int minorVersion = classFileReader.getMinorVersion();
      int majorVersion = classFileReader.getMajorVersion();
      buffer.append(Messages.disassembler_begincommentline);
      if (sourceAttribute != null)
      {
        buffer.append(Messages.disassembler_sourceattributeheader);
        buffer.append(sourceAttribute.getSourceFileName());
      }
      String versionNumber = VERSION_UNKNOWN;
      if ((minorVersion == 3) && (majorVersion == 45)) {
        versionNumber = "1.1";
      } else if ((minorVersion == 0) && (majorVersion == 46)) {
        versionNumber = "1.2";
      } else if ((minorVersion == 0) && (majorVersion == 47)) {
        versionNumber = "1.3";
      } else if ((minorVersion == 0) && (majorVersion == 48)) {
        versionNumber = "1.4";
      } else if ((minorVersion == 0) && (majorVersion == 49)) {
        versionNumber = "1.5";
      } else if ((minorVersion == 0) && (majorVersion == 50)) {
        versionNumber = "1.6";
      } else if ((minorVersion == 0) && (majorVersion == 51)) {
        versionNumber = "1.7";
      }
      buffer.append(NLS.bind(Messages.classfileformat_versiondetails, new String[] { versionNumber, Integer.toString(majorVersion), Integer.toString(minorVersion), ((accessFlags & 0x20) != 0 ? Messages.classfileformat_superflagisset : Messages.classfileformat_superflagisnotset) + (isDeprecated(classFileReader) ? ", deprecated" : "") }));
      
      writeNewLine(buffer, lineSeparator, 0);
      if (signatureAttribute != null)
      {
        buffer.append(NLS.bind(Messages.disassembler_signatureattributeheader, new String(signatureAttribute.getSignature())));
        writeNewLine(buffer, lineSeparator, 0);
      }
    }
    InnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
    ClassFileAttribute runtimeVisibleAnnotationsAttribute = Utility.getAttribute(classFileReader, AttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
    ClassFileAttribute runtimeInvisibleAnnotationsAttribute = Utility.getAttribute(classFileReader, AttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
    if (checkMode(mode, 1))
    {
      if (runtimeInvisibleAnnotationsAttribute != null)
      {
        disassembleAsModifier((RuntimeInvisibleAnnotationsAttribute)runtimeInvisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
        writeNewLine(buffer, lineSeparator, 0);
      }
      if (runtimeVisibleAnnotationsAttribute != null)
      {
        disassembleAsModifier((RuntimeVisibleAnnotationsAttribute)runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
        writeNewLine(buffer, lineSeparator, 0);
      }
    }
    boolean decoded = false;
    if (innerClassesAttribute != null)
    {
      InnerClassesAttributeEntry[] entries = innerClassesAttribute.getInnerClassAttributesEntries();
      int i = 0;
      for (int max = entries.length; i < max; i++)
      {
        InnerClassesAttributeEntry entry = entries[i];
        char[] innerClassName = entry.getInnerClassName();
        if ((innerClassName != null) && 
          (Arrays.equals(classFileReader.getClassName(), innerClassName)))
        {
          decodeModifiersForInnerClasses(buffer, entry.getAccessFlags(), false);
          decoded = true;
        }
      }
    }
    if (!decoded)
    {
      decodeModifiersForType(buffer, accessFlags);
      if (isSynthetic(classFileReader))
      {
        buffer.append("synthetic");
        buffer.append(Messages.disassembler_space);
      }
    }
    boolean isAnnotation = (accessFlags & 0x2000) != 0;
    boolean isInterface = false;
    if (isEnum)
    {
      buffer.append("enum ");
    }
    else if (classFileReader.isClass())
    {
      buffer.append("class ");
    }
    else
    {
      if (isAnnotation) {
        buffer.append("@");
      }
      buffer.append("interface ");
      isInterface = true;
    }
    buffer.append(className);
    
    char[] superclassName = classFileReader.getSuperclassName();
    if (superclassName != null)
    {
      CharOperation.replace(superclassName, '/', '.');
      if ((!isJavaLangObject(superclassName)) && (!isEnum))
      {
        buffer.append(" extends ");
        buffer.append(returnClassName(superclassName, '.', mode));
      }
    }
    if (!isAnnotation)
    {
      char[][] superclassInterfaces = classFileReader.getInterfaceNames();
      int length = superclassInterfaces.length;
      if (length != 0)
      {
        if (isInterface) {
          buffer.append(" extends ");
        } else {
          buffer.append(" implements ");
        }
        for (int i = 0; i < length; i++)
        {
          if (i != 0) {
            buffer.append(Messages.disassembler_comma).append(Messages.disassembler_space);
          }
          char[] superinterface = superclassInterfaces[i];
          CharOperation.replace(superinterface, '/', '.');
          buffer.append(returnClassName(superinterface, '.', 
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