From 2fe5bddc5ad33195e380391310e7b678619d00c3 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 23 Oct 2023 18:33:53 -0700 Subject: [PATCH] Fix #223: apply check for default (interface) method in all applicable places --- .../module/afterburner/deser/PropertyMutatorCollector.java | 6 +++--- release-notes/VERSION-2.x | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/PropertyMutatorCollector.java b/afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/PropertyMutatorCollector.java index 012daf5c7..0f256261a 100644 --- a/afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/PropertyMutatorCollector.java +++ b/afterburner/src/main/java/com/fasterxml/jackson/module/afterburner/deser/PropertyMutatorCollector.java @@ -293,7 +293,7 @@ private > void _addSettersUsingIf(Met // to fix [Issue-5] (don't assume return type is 'void'), we need to: Type returnType = Type.getType(method.getReturnType()); - boolean isInterface = method.getDeclaringClass().isInterface(); + boolean isInterface = isInterfaceMethod(method); mv.visitMethodInsn(isInterface ? INVOKEINTERFACE : INVOKEVIRTUAL, beanClassName, method.getName(), "("+type+")"+returnType, isInterface); mv.visitInsn(RETURN); @@ -318,7 +318,7 @@ private > void _addSettersUsingIf(Met if (mustCast) { mv.visitTypeInsn(CHECKCAST, type.getInternalName()); } - isInterface = method.getDeclaringClass().isInterface(); + isInterface = isInterfaceMethod(method); mv.visitMethodInsn(isInterface ? INVOKEINTERFACE : INVOKEVIRTUAL, beanClassName, method.getName(), "("+type+")"+returnType, isInterface); mv.visitInsn(RETURN); @@ -348,7 +348,7 @@ private > void _addSettersUsingSwitch if (mustCast) { mv.visitTypeInsn(CHECKCAST, type.getInternalName()); } - boolean isInterface = method.getDeclaringClass().isInterface(); + boolean isInterface = isInterfaceMethod(method); mv.visitMethodInsn(isInterface ? INVOKEINTERFACE : INVOKEVIRTUAL, beanClassName, method.getName(), "("+type+")"+returnType, isInterface); mv.visitInsn(RETURN); diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index e486dc6e1..22cabffd3 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -21,6 +21,10 @@ Active maintainers: === Releases === ------------------------------------------------------------------------ +#223: IncompatibleClassChangeError when deserializing a class implementing + an interface with default get/set implementations + (reported by @avnersin) + 2.16.0-rc1 (20-Oct-2023) #181: (blackbird) BlackBird proxy object error in Java 17