private String[] getParameterNamesForMethod() { if (collector == null) { return Paranamer.EMPTY_NAMES; } if (!collector.isDebugInfoPresent()) { if (throwExceptionIfMissing) { throw new ParameterNamesNotFoundException("Parameter names not found for " + methodName); } else { return Paranamer.EMPTY_NAMES; } } return collector.getResult().split(COMMA); }
private int readMethod(TypeCollector classVisitor, char[] c, int u) { int v; int w; int j; String attrName; int k; int access = readUnsignedShort(u); String name = readUTF8(u + 2, c); String desc = readUTF8(u + 4, c); v = 0; w = 0; // looks for Code and Exceptions attributes j = readUnsignedShort(u + 6); u += 8; for (; j > 0; --j) { attrName = readUTF8(u, c); int attrSize = readInt(u + 2); u += 6; // tests are sorted in decreasing frequency order // (based on frequencies observed on typical classes) if (attrName.equals("Code")) { v = u; } u += attrSize; } // reads declared exceptions if (w == 0) { } else { w += 2; for (j = 0; j < readUnsignedShort(w); ++j) { w += 2; } } // visits the method's code, if any MethodCollector mv = classVisitor.visitMethod(access, name, desc); if (mv != null && v != 0) { int codeLength = readInt(v + 4); v += 8; int codeStart = v; int codeEnd = v + codeLength; v = codeEnd; j = readUnsignedShort(v); v += 2; for (; j > 0; --j) { v += 8; } // parses the local variable, line number tables, and code // attributes int varTable = 0; int varTypeTable = 0; j = readUnsignedShort(v); v += 2; for (; j > 0; --j) { attrName = readUTF8(v, c); if (attrName.equals("LocalVariableTable")) { varTable = v + 6; } else if (attrName.equals("LocalVariableTypeTable")) { varTypeTable = v + 6; } v += 6 + readInt(v + 2); } v = codeStart; // visits the local variable tables if (varTable != 0) { if (varTypeTable != 0) { k = readUnsignedShort(varTypeTable) * 3; w = varTypeTable + 2; int[] typeTable = new int[k]; while (k > 0) { typeTable[--k] = w + 6; // signature typeTable[--k] = readUnsignedShort(w + 8); // index typeTable[--k] = readUnsignedShort(w); // start w += 10; } } k = readUnsignedShort(varTable); w = varTable + 2; for (; k > 0; --k) { int index = readUnsignedShort(w + 8); mv.visitLocalVariable(readUTF8(w + 4, c), index); w += 10; } } } return u; }