private IClassFileAttribute getAttribute(final char[] attributeName, final ICodeAttribute codeAttribute) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0, max = attributes.length; i < max; i++) { if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) { return attributes[i]; } } return null; }
public DefaultBytecodeVisitor(ICodeAttribute codeAttribute, char[][] parameterNames, char[] methodDescriptor, boolean isStatic, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); this.localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (this.localVariableAttributeLength != 0) { this.localVariableTableEntries = localVariableAttribute.getLocalVariableTable(); } else { this.localVariableTableEntries = null; } this.buffer = buffer; this.lineSeparator = lineSeparator; this.tabNumber = tabNumber + 1; long codeLength = codeAttribute.getCodeLength(); this.digitNumberForPC = Long.toString(codeLength).length(); this.mode = mode; this.parameterNames = parameterNames; this.isStatic = isStatic; // compute argument sizes if (parameterNames != null) { char[][] parameterTypes = Signature.getParameterTypes(methodDescriptor); int length = parameterTypes.length; this.argumentSizes = new int[length]; for (int i = 0; i < length; i++) { char[] parameterType = parameterTypes[i]; this.argumentSizes[i] = parameterType.length == 1 && (parameterType[0] == 'D' || parameterType[0] == 'J') ? 2 : 1; } } } /**
DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, parameterNames, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode); try { codeAttribute.traverse(visitor); } catch(ClassFormatException e) { dumpTab(tabNumber + 2, buffer); final int exceptionTableLength = codeAttribute.getExceptionTableLength(); boolean isFirstAttribute = true; if (exceptionTableLength != 0) { isFirstAttribute = false; dumpTab(tabNumberForExceptionAttribute, buffer); final IExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable(); buffer.append(Messages.disassembler_exceptiontableheader); writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1); final ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute(); final int lineAttributeLength = lineNumberAttribute == null ? 0 : lineNumberAttribute.getLineNumberTableLength(); if (lineAttributeLength != 0) { final ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); final int localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (localVariableAttributeLength != 0) { final int length = codeAttribute.getAttributesCount(); if (length != 0) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i];
buffer.append(Messages.bind(Messages.classfileformat_stacksAndLocals, new String[] { Integer.toString(codeAttribute.getMaxStack()), Integer.toString(codeAttribute.getMaxLocals()) })); writeNewLine(buffer, lineSeparator, tabNumber);
private char[][] getParameterNames(char[] methodDescriptor, ICodeAttribute codeAttribute, int accessFlags) { int paramCount = Signature.getParameterCount(methodDescriptor); char[][] parameterNames = new char[paramCount][]; // check if the code attribute has debug info for this method if (codeAttribute != null) { ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); if (localVariableAttribute != null) { ILocalVariableTableEntry[] entries = localVariableAttribute.getLocalVariableTable(); final int startingIndex = (accessFlags & IModifierConstants.ACC_STATIC) != 0 ? 0 : 1; for (int i = 0; i < paramCount; i++) { ILocalVariableTableEntry searchedEntry = getEntryFor(getLocalIndex(startingIndex, i, methodDescriptor), entries); if (searchedEntry != null) { parameterNames[i] = searchedEntry.getName(); } else { parameterNames[i] = CharOperation.concat(Messages.disassembler_parametername.toCharArray(), Integer.toString(i).toCharArray()); } } } else { for (int i = 0; i < paramCount; i++) { parameterNames[i] = CharOperation.concat(Messages.disassembler_parametername.toCharArray(), Integer.toString(i).toCharArray()); } } } else { for (int i = 0; i < paramCount; i++) { parameterNames[i] = CharOperation.concat(Messages.disassembler_parametername.toCharArray(), Integer.toString(i).toCharArray()); } } return parameterNames; }
DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, parameterNames, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode); try { codeAttribute.traverse(visitor); } catch(ClassFormatException e) { dumpTab(tabNumber + 3, buffer); final int exceptionTableLength = codeAttribute.getExceptionTableLength(); boolean isFirstAttribute = true; if (exceptionTableLength != 0) { isFirstAttribute = false; dumpTab(tabNumberForExceptionAttribute, buffer); final IExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable(); buffer.append(Messages.disassembler_exceptiontableheader); writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1); final ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute(); final int lineAttributeLength = lineNumberAttribute == null ? 0 : lineNumberAttribute.getLineNumberTableLength(); if (lineAttributeLength != 0) { final ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); final int localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (localVariableAttributeLength != 0) { final int length = codeAttribute.getAttributesCount(); if (length != 0) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i];
buffer.append(Messages.bind(Messages.classfileformat_stacksAndLocals, new String[] { Integer.toString(codeAttribute.getMaxStack()), Integer.toString(codeAttribute.getMaxLocals()) })); writeNewLine(buffer, lineSeparator, tabNumber);
ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); if (localVariableAttribute != null) { ILocalVariableTableEntry[] entries = localVariableAttribute.getLocalVariableTable();
DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, parameterNames, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode); try { codeAttribute.traverse(visitor); } catch(ClassFormatException e) { dumpTab(tabNumber + 3, buffer); final int exceptionTableLength = codeAttribute.getExceptionTableLength(); boolean isFirstAttribute = true; if (exceptionTableLength != 0) { isFirstAttribute = false; dumpTab(tabNumberForExceptionAttribute, buffer); final IExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable(); buffer.append(Messages.disassembler_exceptiontableheader); writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1); final ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute(); final int lineAttributeLength = lineNumberAttribute == null ? 0 : lineNumberAttribute.getLineNumberTableLength(); if (lineAttributeLength != 0) { final ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); final int localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (localVariableAttributeLength != 0) { final int length = codeAttribute.getAttributesCount(); if (length != 0) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i];
public DefaultBytecodeVisitor(ICodeAttribute codeAttribute, char[][] parameterNames, char[] methodDescriptor, boolean isStatic, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); this.localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (this.localVariableAttributeLength != 0) { this.localVariableTableEntries = localVariableAttribute.getLocalVariableTable(); } else { this.localVariableTableEntries = null; } this.buffer = buffer; this.lineSeparator = lineSeparator; this.tabNumber = tabNumber + 1; long codeLength = codeAttribute.getCodeLength(); this.digitNumberForPC = Long.toString(codeLength).length(); this.mode = mode; this.parameterNames = parameterNames; this.isStatic = isStatic; // compute argument sizes if (parameterNames != null) { char[][] parameterTypes = Signature.getParameterTypes(methodDescriptor); int length = parameterTypes.length; this.argumentSizes = new int[length]; for (int i = 0; i < length; i++) { char[] parameterType = parameterTypes[i]; this.argumentSizes[i] = parameterType.length == 1 && (parameterType[0] == 'D' || parameterType[0] == 'J') ? 2 : 1; } } } /**
buffer.append(Messages.bind(Messages.classfileformat_stacksAndLocals, new String[] { Integer.toString(codeAttribute.getMaxStack()), Integer.toString(codeAttribute.getMaxLocals()) })); writeNewLine(buffer, lineSeparator, tabNumber);
private IClassFileAttribute getAttribute(final char[] attributeName, final ICodeAttribute codeAttribute) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0, max = attributes.length; i < max; i++) { if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) { return attributes[i]; } } return null; }
ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); if (localVariableAttribute != null) { ILocalVariableTableEntry[] entries = localVariableAttribute.getLocalVariableTable();
DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, parameterNames, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode); try { codeAttribute.traverse(visitor); } catch(ClassFormatException e) { dumpTab(tabNumber + 2, buffer); final int exceptionTableLength = codeAttribute.getExceptionTableLength(); boolean isFirstAttribute = true; if (exceptionTableLength != 0) { isFirstAttribute = false; dumpTab(tabNumberForExceptionAttribute, buffer); final IExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable(); buffer.append(Messages.disassembler_exceptiontableheader); writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1); final ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute(); final int lineAttributeLength = lineNumberAttribute == null ? 0 : lineNumberAttribute.getLineNumberTableLength(); if (lineAttributeLength != 0) { final ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); final int localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (localVariableAttributeLength != 0) { final int length = codeAttribute.getAttributesCount(); if (length != 0) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i];
public DefaultBytecodeVisitor(ICodeAttribute codeAttribute, char[][] parameterNames, char[] methodDescriptor, boolean isStatic, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); this.localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (this.localVariableAttributeLength != 0) { this.localVariableTableEntries = localVariableAttribute.getLocalVariableTable(); } else { this.localVariableTableEntries = null; } this.buffer = buffer; this.lineSeparator = lineSeparator; this.tabNumber = tabNumber + 1; long codeLength = codeAttribute.getCodeLength(); this.digitNumberForPC = Long.toString(codeLength).length(); this.mode = mode; this.parameterNames = parameterNames; this.isStatic = isStatic; // compute argument sizes if (parameterNames != null) { char[][] parameterTypes = Signature.getParameterTypes(methodDescriptor); int length = parameterTypes.length; this.argumentSizes = new int[length]; for (int i = 0; i < length; i++) { char[] parameterType = parameterTypes[i]; this.argumentSizes[i] = parameterType.length == 1 && (parameterType[0] == 'D' || parameterType[0] == 'J') ? 2 : 1; } } } /**
buffer.append(Messages.bind(Messages.classfileformat_stacksAndLocals, new String[] { Integer.toString(codeAttribute.getMaxStack()), Integer.toString(codeAttribute.getMaxLocals()) })); writeNewLine(buffer, lineSeparator, tabNumber);
private IClassFileAttribute getAttribute(final char[] attributeName, final ICodeAttribute codeAttribute) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0, max = attributes.length; i < max; i++) { if (CharOperation.equals(attributes[i].getAttributeName(), attributeName)) { return attributes[i]; } } return null; }
ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); if (localVariableAttribute != null) { ILocalVariableTableEntry[] entries = localVariableAttribute.getLocalVariableTable();
DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, parameterNames, methodDescriptor, isStatic, buffer, lineSeparator, tabNumber, mode); try { codeAttribute.traverse(visitor); } catch(ClassFormatException e) { dumpTab(tabNumber + 3, buffer); final int exceptionTableLength = codeAttribute.getExceptionTableLength(); boolean isFirstAttribute = true; if (exceptionTableLength != 0) { isFirstAttribute = false; dumpTab(tabNumberForExceptionAttribute, buffer); final IExceptionTableEntry[] exceptionTableEntries = codeAttribute.getExceptionTable(); buffer.append(Messages.disassembler_exceptiontableheader); writeNewLine(buffer, lineSeparator, tabNumberForExceptionAttribute + 1); final ILineNumberAttribute lineNumberAttribute = codeAttribute.getLineNumberAttribute(); final int lineAttributeLength = lineNumberAttribute == null ? 0 : lineNumberAttribute.getLineNumberTableLength(); if (lineAttributeLength != 0) { final ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); final int localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (localVariableAttributeLength != 0) { final int length = codeAttribute.getAttributesCount(); if (length != 0) { IClassFileAttribute[] attributes = codeAttribute.getAttributes(); for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i];
public DefaultBytecodeVisitor(ICodeAttribute codeAttribute, char[][] parameterNames, char[] methodDescriptor, boolean isStatic, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { ILocalVariableAttribute localVariableAttribute = codeAttribute.getLocalVariableAttribute(); this.localVariableAttributeLength = localVariableAttribute == null ? 0 : localVariableAttribute.getLocalVariableTableLength(); if (this.localVariableAttributeLength != 0) { this.localVariableTableEntries = localVariableAttribute.getLocalVariableTable(); } else { this.localVariableTableEntries = null; } this.buffer = buffer; this.lineSeparator = lineSeparator; this.tabNumber = tabNumber + 1; long codeLength = codeAttribute.getCodeLength(); this.digitNumberForPC = Long.toString(codeLength).length(); this.mode = mode; this.parameterNames = parameterNames; this.isStatic = isStatic; // compute argument sizes if (parameterNames != null) { char[][] parameterTypes = Signature.getParameterTypes(methodDescriptor); int length = parameterTypes.length; this.argumentSizes = new int[length]; for (int i = 0; i < length; i++) { char[] parameterType = parameterTypes[i]; this.argumentSizes[i] = parameterType.length == 1 && (parameterType[0] == 'D' || parameterType[0] == 'J') ? 2 : 1; } } } /**