diff options
author | syev <[email protected]> | 2014-10-24 18:46:01 +0200 |
---|---|---|
committer | syev <[email protected]> | 2014-10-24 18:46:01 +0200 |
commit | 327e7fdf59a05f16a050b4132abe4b8b4b0d93be (patch) | |
tree | 40192180581c602f8a103a0591d61f8a0d8ba5cf /api/src/main/java/org/osjava/jardiff/Tools.java | |
parent | 28320018e8c6f97a37389aa14af3e14c5b082701 (diff) |
Clarifications about access permissions checks
Renamed the Tools method that checks the access permissions /
visibility.
Added comments.
Diffstat (limited to 'api/src/main/java/org/osjava/jardiff/Tools.java')
-rw-r--r-- | api/src/main/java/org/osjava/jardiff/Tools.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/api/src/main/java/org/osjava/jardiff/Tools.java b/api/src/main/java/org/osjava/jardiff/Tools.java index 41ba63c..42ba817 100644 --- a/api/src/main/java/org/osjava/jardiff/Tools.java +++ b/api/src/main/java/org/osjava/jardiff/Tools.java @@ -65,7 +65,7 @@ public final class Tools return (value & mask) == 0; } - private static boolean isLessAccessPermitted(int oldAccess, int newAccess) { + private static boolean isAccessIncompatible(int oldAccess, int newAccess) { if (has(newAccess, Opcodes.ACC_PUBLIC)) { return false; } else if (has(newAccess, Opcodes.ACC_PROTECTED)) { @@ -73,6 +73,7 @@ public final class Tools } else if (has(newAccess, Opcodes.ACC_PRIVATE)) { return not(oldAccess, Opcodes.ACC_PRIVATE); } else { + // new access is package, it is incompatible if old access was public or protected return has(oldAccess, Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED); } } @@ -175,7 +176,7 @@ public final class Tools * @return */ public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { - if (isLessAccessPermitted(oldAccess, newAccess)) { + if (isAccessIncompatible(oldAccess, newAccess)) { return true; // 13.4.7 } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { @@ -244,7 +245,7 @@ public final class Tools * @return */ public static boolean isMethodAccessChange(final int oldAccess, final int newAccess) { - if (isLessAccessPermitted(oldAccess, newAccess)) { + if (isAccessIncompatible(oldAccess, newAccess)) { return true; // 13.4.7 } if ( not(oldAccess, Opcodes.ACC_ABSTRACT) && has(newAccess, Opcodes.ACC_ABSTRACT) ) { |