Skip to content

Commit

Permalink
Ignore only synthetic non-bridge methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Apr 20, 2024
1 parent ba39ea9 commit df7205b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static ClassInfoComparisonResults compare(boolean checkBinary, @Nullable

for (MethodInfo baseInfo : baseClassInfo.getMethods().values()) {
// base synthetic -> ignore changes
if (AccessHelpers.isSynthetic(baseInfo)) continue;
if (AccessHelpers.isSynthetic(baseInfo) && !AccessHelpers.isBridge(baseInfo)) continue;

boolean isStatic = (baseInfo.access & Opcodes.ACC_STATIC) != 0;
MethodInfo inputInfo = getMethodInfo(concreteClassInfo, concreteParents, isStatic, baseInfo.name, baseInfo.desc);
Expand All @@ -125,7 +125,7 @@ public static ClassInfoComparisonResults compare(boolean checkBinary, @Nullable
boolean methodVisible = isVisible(checkBinary, baseInfo.access);

// base non-synthetic -> synthetic should be considered an error as synthetic methods aren't stable
if (inputInfo == null || AccessHelpers.isSynthetic(inputInfo)) {
if (inputInfo == null || (AccessHelpers.isSynthetic(inputInfo) && !AccessHelpers.isBridge(inputInfo))) {
if (checkBinary) {
results.addMethodIncompatibility(baseInfo, IncompatibilityMessages.METHOD_REMOVED, isMethodError);
} else if (methodVisible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ public static boolean isSynthetic(int access) {
public static boolean isSynthetic(MemberInfo info) {
return isSynthetic(info.getAccess());
}

public static boolean isBridge(MemberInfo info) {
return ((info.getAccess() & Opcodes.ACC_BRIDGE)) != 0;
}
}

0 comments on commit df7205b

Please sign in to comment.