From 3acd4aad506faacd9b4ef9271df9bb0599300cae Mon Sep 17 00:00:00 2001 From: syev Date: Fri, 24 Oct 2014 11:50:17 +0200 Subject: Changed members detection update Check the members against all the new members, not only the ones that match the DiffCriteria. --- api/src/main/java/org/osjava/jardiff/JarDiff.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/osjava/jardiff/JarDiff.java b/api/src/main/java/org/osjava/jardiff/JarDiff.java index 432993a..d391712 100644 --- a/api/src/main/java/org/osjava/jardiff/JarDiff.java +++ b/api/src/main/java/org/osjava/jardiff/JarDiff.java @@ -393,12 +393,12 @@ public class JarDiff } changedMethods.addAll(removedMethods); - changedMethods.retainAll(addedMethods); + changedMethods.retainAll(newMethods.keySet()); removedMethods.removeAll(changedMethods); removedMethods.removeAll(extNewMethods.keySet()); addedMethods.removeAll(changedMethods); changedFields.addAll(removedFields); - changedFields.retainAll(addedFields); + changedFields.retainAll(newFields.keySet()); removedFields.removeAll(changedFields); removedFields.removeAll(extNewFields.keySet()); addedFields.removeAll(changedFields); -- cgit v1.2.3 From 32b247d1dc0209faa5cb79b3db72ccc54ebb8991 Mon Sep 17 00:00:00 2001 From: syev Date: Fri, 24 Oct 2014 12:01:39 +0200 Subject: Add access permissions checks --- api/src/main/java/org/osjava/jardiff/Tools.java | 48 ++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/osjava/jardiff/Tools.java b/api/src/main/java/org/osjava/jardiff/Tools.java index 7ac6a42..41ba63c 100644 --- a/api/src/main/java/org/osjava/jardiff/Tools.java +++ b/api/src/main/java/org/osjava/jardiff/Tools.java @@ -65,6 +65,18 @@ public final class Tools return (value & mask) == 0; } + private static boolean isLessAccessPermitted(int oldAccess, int newAccess) { + if (has(newAccess, Opcodes.ACC_PUBLIC)) { + return false; + } else if (has(newAccess, Opcodes.ACC_PROTECTED)) { + return has(oldAccess, Opcodes.ACC_PUBLIC); + } else if (has(newAccess, Opcodes.ACC_PRIVATE)) { + return not(oldAccess, Opcodes.ACC_PRIVATE); + } else { + return has(oldAccess, Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED); + } + } + /** * @deprecated Use {@link #isClassAccessChange(int, int)}. */ @@ -118,6 +130,14 @@ public final class Tools * Returns whether a field's newAccess is incompatible with oldAccess * following Java Language Specification, Java SE 7 Edition: *