@Test public void isFieldAccessChange() { assertTrue(Tools.isFieldAccessChange(0, Opcodes.ACC_FINAL)); assertTrue(Tools.isFieldAccessChange(0, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_FINAL, 0)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_FINAL + Opcodes.ACC_PUBLIC, Opcodes.ACC_PUBLIC)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PROTECTED, Opcodes.ACC_PUBLIC)); assertFalse(Tools.isFieldAccessChange(0, Opcodes.ACC_PUBLIC)); assertFalse(Tools.isFieldAccessChange(0, Opcodes.ACC_PROTECTED)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PRIVATE, Opcodes.ACC_PUBLIC)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PRIVATE, Opcodes.ACC_PROTECTED)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PRIVATE, 0)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_FINAL + Opcodes.ACC_PUBLIC, 0)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_PUBLIC, Opcodes.ACC_PROTECTED)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_PUBLIC, Opcodes.ACC_PRIVATE)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_PROTECTED, 0)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_PROTECTED, Opcodes.ACC_PRIVATE)); assertTrue(Tools.isFieldAccessChange(0, Opcodes.ACC_PRIVATE)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_STATIC, 0)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC, Opcodes.ACC_PUBLIC)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_VOLATILE, 0)); assertTrue(Tools.isFieldAccessChange(Opcodes.ACC_VOLATILE + Opcodes.ACC_PUBLIC, Opcodes.ACC_PUBLIC)); assertFalse(Tools.isFieldAccessChange(0, Opcodes.ACC_TRANSIENT)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PUBLIC, Opcodes.ACC_PUBLIC + Opcodes.ACC_TRANSIENT)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_TRANSIENT, 0)); assertFalse(Tools.isFieldAccessChange(Opcodes.ACC_PUBLIC + Opcodes.ACC_TRANSIENT, Opcodes.ACC_PUBLIC)); }
public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { if (isAccessIncompatible(oldAccess, newAccess)) { return true; } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { return true; } else { final int compatibleChanges = Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT; final int accessPermissions = Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE; final int oldAccess2 = oldAccess & ~compatibleChanges & ~accessPermissions; final int newAccess2 = newAccess & ~compatibleChanges & ~accessPermissions; return oldAccess2 != newAccess2; } }
Tools { public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { if (isAccessIncompatible(oldAccess, newAccess)) { return true; } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { return true; } else { final int compatibleChanges = Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT; final int accessPermissions = Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE; final int oldAccess2 = oldAccess & ~compatibleChanges & ~accessPermissions; final int newAccess2 = newAccess & ~compatibleChanges & ~accessPermissions; return oldAccess2 != newAccess2; } } }
Tools { public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { if (isAccessIncompatible(oldAccess, newAccess)) { return true; } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { return true; } else { final int compatibleChanges = Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT; final int accessPermissions = Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE; final int oldAccess2 = oldAccess & ~compatibleChanges & ~accessPermissions; final int newAccess2 = newAccess & ~compatibleChanges & ~accessPermissions; return oldAccess2 != newAccess2; } } private  Tools(); }
Tools { public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { if (isAccessIncompatible(oldAccess, newAccess)) { return true; } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { return true; } else { final int compatibleChanges = Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT; final int accessPermissions = Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE; final int oldAccess2 = oldAccess & ~compatibleChanges & ~accessPermissions; final int newAccess2 = newAccess & ~compatibleChanges & ~accessPermissions; return oldAccess2 != newAccess2; } } private  Tools(); static final String getClassName(String internalName); static boolean isAccessChange(int oldAccess, int newAccess); static boolean isClassAccessChange(final int oldAccess, final int newAccess); static boolean isFieldAccessChange(final int oldAccess, final int newAccess); static boolean isMethodAccessChange(final int oldAccess, final int newAccess); }
Tools { public static boolean isFieldAccessChange(final int oldAccess, final int newAccess) { if (isAccessIncompatible(oldAccess, newAccess)) { return true; } if ( not(oldAccess, Opcodes.ACC_FINAL) && has(newAccess, Opcodes.ACC_FINAL) ) { return true; } else { final int compatibleChanges = Opcodes.ACC_FINAL | Opcodes.ACC_TRANSIENT; final int accessPermissions = Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE; final int oldAccess2 = oldAccess & ~compatibleChanges & ~accessPermissions; final int newAccess2 = newAccess & ~compatibleChanges & ~accessPermissions; return oldAccess2 != newAccess2; } } private  Tools(); static final String getClassName(String internalName); static boolean isAccessChange(int oldAccess, int newAccess); static boolean isClassAccessChange(final int oldAccess, final int newAccess); static boolean isFieldAccessChange(final int oldAccess, final int newAccess); static boolean isMethodAccessChange(final int oldAccess, final int newAccess);  }