final Map[] classMethods = { new HashMap(), new HashMap() };
for (int i = 0; i < 2; i++) {
for (Enumeration e = classFiles[i].methods().elements();
e.hasMoreElements();) {
final ClassMethod method = (ClassMethod)e.nextElement();
final String methodSig = method.signature().asString();
final String methodArgs = Descriptor.userMethodArgs(methodSig);
final String methodName = method.name().asString();
if (methodName.startsWith("jdo")) {
//if (methodName.equals("jdoReplaceField")) {
final Object obj
= classMethods[i].put(methodName + methodArgs, method);
affirm(obj == null);
}
}
}
final Set keySet = new HashSet();
keySet.addAll(classMethods[0].keySet());
keySet.addAll(classMethods[1].keySet());
for (Iterator i = keySet.iterator(); i.hasNext();) {
final Object key = i.next();
final ClassMethod method0
= (ClassMethod)classMethods[0].remove(key);
final ClassMethod method1
= (ClassMethod)classMethods[1].remove(key);
affirm(method0 != method1);
affirm(method0 != null || method1 != null);
if (method0 == null || method1 == null) {
out.println(" !!! ERROR: missing method: " + key);
out.println(" <<< method: " + method0);
out.println(" >>> method: " + method1);
res = ERROR;
continue;
}
final Stack msg = new Stack();
if (method0.isEqual(msg, method1)) {
if (verbose) {
out.println(" +++ equal augmentation: " + key);
}
} else {
out.println(" !!! not equal augmentation: " + key);
msg.push("method = " + method1);
msg.push("method = " + method0);
final StringWriter s0 = new StringWriter();
final StringWriter s1 = new StringWriter();
final PrintWriter p0 = new PrintWriter(s0);
final PrintWriter p1 = new PrintWriter(s1);
int j = 0;
while (!msg.empty()) {
p0.println(" <<< " + pad(j) + msg.pop());
p1.println(" >>> " + pad(j) + msg.pop());
j += 4;
}
out.println(s0.toString());
out.println(s1.toString());
if (verbose) {
ByteArrayOutputStream b0 = new ByteArrayOutputStream();
ByteArrayOutputStream b1 = new ByteArrayOutputStream();
method0.print(new PrintStream(b0), 4);
method1.print(new PrintStream(b1), 4);
out.println(b0.toString());
out.println(b1.toString());
if (res == NEGATIVE) {
res = AFFIRMATIVE;
}