private void commandMethods(StringTokenizer t) throws NoSessionException { if (!t.hasMoreTokens()) { env.error("No class specified."); return; } String idClass = t.nextToken(); ReferenceType cls = findClass(idClass); if (cls != null) { List<Method> methods = cls.allMethods(); OutputSink out = env.getOutputSink(); for (int i = 0; i < methods.size(); i++) { Method method = methods.get(i); out.print(method.declaringType().name() + " " + method.name() + "("); Iterator<String> it = method.argumentTypeNames().iterator(); if (it.hasNext()) { while (true) { out.print(it.next()); if (!it.hasNext()) { break; } out.print(", "); } } out.println(")"); } out.show(); } else { // ### Should validate class name syntax. env.failure("\"" + idClass + "\" is not a valid id or class name."); } }
// TODO this is not sufficient only does method names not line locations public Location resolveLocation(String location) { DalvikUtils.LOGGER.warn("line locations not yet implemented!"); location = location.trim(); Location loc = null; int endIdx = location.lastIndexOf("."); if (endIdx != -1) { String className = location.substring(0, endIdx); ReferenceType cr = this.findClassType(className); if (cr != null) { for (Method m : cr.allMethods()) { // TODO need to think on this comparison ... if (m.toString().contains(location)) { loc = m.location(); break; } } } } return loc; }