return all classes and packages

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@293 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent bb39f34c3f
commit 58932da6b2
  1. 10
      jode/jode/bytecode/ClassInfo.java

@ -71,9 +71,9 @@ public class ClassInfo extends BinaryInfo {
return classpath.isDirectory(name.replace('.', '/')); return classpath.isDirectory(name.replace('.', '/'));
} }
public static Enumeration getClasses(final String packageName) { public static Enumeration getClassesAndPackages(final String packageName) {
final Enumeration enum = final Enumeration enum =
classpath.listClassFiles(packageName.replace('.','/')); classpath.listFiles(packageName.replace('.','/'));
return new Enumeration() { return new Enumeration() {
public boolean hasMoreElements() { public boolean hasMoreElements() {
return enum.hasMoreElements(); return enum.hasMoreElements();
@ -81,9 +81,9 @@ public class ClassInfo extends BinaryInfo {
public Object nextElement() { public Object nextElement() {
String name = (String) enum.nextElement(); String name = (String) enum.nextElement();
if (!name.endsWith(".class")) if (!name.endsWith(".class"))
throw new jode.AssertError("Wrong file name"); // This is a package
return ClassInfo.forName(packageName + "." return name;
+ name.substring(0, name.length()-6)); return name.substring(0, name.length()-6);
} }
}; };

Loading…
Cancel
Save