diff options
author | Timo Westkämper <[email protected]> | 2014-04-16 22:31:58 +0300 |
---|---|---|
committer | Timo Westkämper <[email protected]> | 2014-04-16 22:31:58 +0300 |
commit | 76ea6e213607bf82f8b8215300f709e664e35546 (patch) | |
tree | a9769027e6176f5d3a56c9c257798f47ace62be2 | |
parent | 0997367dfea0ae2d68854c3602c6a7641e7a3665 (diff) |
Add superclass handling
-rw-r--r-- | api/src/main/java/org/osjava/jardiff/JarDiff.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/api/src/main/java/org/osjava/jardiff/JarDiff.java b/api/src/main/java/org/osjava/jardiff/JarDiff.java index e0f89d9..cff4278 100644 --- a/api/src/main/java/org/osjava/jardiff/JarDiff.java +++ b/api/src/main/java/org/osjava/jardiff/JarDiff.java @@ -366,6 +366,31 @@ public class JarDiff if (criteria.validClass(oci) || criteria.validClass(nci)) { Map oldMethods = oci.getMethodMap(); Map oldFields = oci.getFieldMap(); + Map extOldMethods = new HashMap(oldMethods); + Map extOldFields = new HashMap(oldFields); + + String superClass = oci.getSupername(); + while (superClass != null && oldClassInfo.containsKey(superClass)) { + ClassInfo sci = (ClassInfo) oldClassInfo.get(superClass); + Iterator j = sci.getFieldMap().entrySet().iterator(); + while (j.hasNext()) { + Map.Entry entry = (Map.Entry) j.next(); + if (!((FieldInfo)entry.getValue()).isPrivate() + && !extOldFields.containsKey(entry.getKey())) { + extOldFields.put(entry.getKey(), entry.getValue()); + } + } + j = sci.getMethodMap().entrySet().iterator(); + while (j.hasNext()) { + Map.Entry entry = (Map.Entry) j.next(); + if (!((MethodInfo)entry.getValue()).isPrivate() + && !extOldMethods.containsKey(entry.getKey())) { + extOldMethods.put(entry.getKey(), entry.getValue()); + } + } + superClass = sci.getSupername(); + } + Map newMethods = nci.getMethodMap(); Map newFields = nci.getFieldMap(); Iterator j = oldMethods.entrySet().iterator(); @@ -392,13 +417,16 @@ public class JarDiff if (criteria.validField((FieldInfo) entry.getValue())) addedFields.add(entry.getKey()); } + changedMethods.addAll(removedMethods); changedMethods.retainAll(addedMethods); removedMethods.removeAll(changedMethods); + removedMethods.removeAll(extOldMethods.keySet()); addedMethods.removeAll(changedMethods); changedFields.addAll(removedFields); changedFields.retainAll(addedFields); removedFields.removeAll(changedFields); + removedFields.removeAll(extOldFields.keySet()); addedFields.removeAll(changedFields); j = changedMethods.iterator(); while (j.hasNext()) { |