OUTERCLASSES and reflection implemented

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@758 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 28a90a13fb
commit ef61e01b42
  1. 26
      jode/jode/bytecode/ClassInfo.java

@ -454,6 +454,7 @@ public class ClassInfo extends BinaryInfo {
("Could only get public methods of class " ("Could only get public methods of class "
+ name + "."); + name + ".");
} }
if (is.length > 0) {
innerClasses = new InnerClassInfo[is.length]; innerClasses = new InnerClassInfo[is.length];
for (int i = is.length; --i >= 0; ) { for (int i = is.length; --i >= 0; ) {
String inner = is[i].getName(); String inner = is[i].getName();
@ -463,6 +464,28 @@ public class ClassInfo extends BinaryInfo {
(inner, getName(), name, is[i].getModifiers()); (inner, getName(), name, is[i].getModifiers());
} }
} }
}
if ((howMuch & INNERCLASSES) != 0 && outerClasses == null) {
int count = 0;
Class declarer = clazz.getDeclaringClass();
while (declarer != null) {
count++;
declarer = declarer.getDeclaringClass();
}
if (count > 0) {
outerClasses = new InnerClassInfo[count];
Class current = clazz;
for (int i = 0; i < count; i++) {
declarer = current.getDeclaringClass();
String name = current.getName();
int dollar = name.lastIndexOf('$');
outerClasses[i] = new InnerClassInfo
(name, declarer.getName(),
name.substring(dollar+1), current.getModifiers());
current = declarer;
}
}
}
status |= howMuch; status |= howMuch;
} }
@ -476,7 +499,8 @@ public class ClassInfo extends BinaryInfo {
} catch (IOException ex) { } catch (IOException ex) {
String message = ex.getMessage(); String message = ex.getMessage();
if ((howMuch & ~(FIELDS|METHODS|HIERARCHY|INNERCLASSES)) != 0) { if ((howMuch & ~(FIELDS|METHODS|HIERARCHY
|INNERCLASSES|OUTERCLASSES)) != 0) {
GlobalOptions.err.println GlobalOptions.err.println
("Can't read class " + name + "."); ("Can't read class " + name + ".");
ex.printStackTrace(GlobalOptions.err); ex.printStackTrace(GlobalOptions.err);

Loading…
Cancel
Save