Support mixed compilation of new default with non-default or @JvmDefault
This commit is contained in:
committed by
Mikhail Bogdanov
parent
a3f930d2e4
commit
e45a892499
@@ -222,8 +222,11 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
|
||||
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.getNonPrivateTraitMethods(descriptor).entrySet()) {
|
||||
FunctionDescriptor interfaceFun = entry.getKey();
|
||||
//skip java 8 default methods
|
||||
if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) && !JvmAnnotationUtilKt
|
||||
.isCompiledToJvmDefaultIfNoAbstract(interfaceFun, state.getJvmDefaultMode())) {
|
||||
if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) &&
|
||||
!JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefaultIfNoAbstract(
|
||||
DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(interfaceFun), state.getJvmDefaultMode()
|
||||
)
|
||||
) {
|
||||
generateDelegationToDefaultImpl(interfaceFun, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,7 +732,9 @@ public class FunctionCodegen {
|
||||
@NotNull JvmDefaultMode jvmDefaultMode
|
||||
) {
|
||||
return OwnerKind.DEFAULT_IMPLS == context.getContextKind() &&
|
||||
JvmAnnotationUtilKt.isCompiledToJvmDefaultIfNoAbstract(functionDescriptor, jvmDefaultMode) &&
|
||||
JvmAnnotationUtilKt
|
||||
.isCompiledToJvmDefaultIfNoAbstract(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
|
||||
jvmDefaultMode) &&
|
||||
jvmDefaultMode.isCompatibility();
|
||||
}
|
||||
|
||||
|
||||
@@ -1540,7 +1540,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
return if (descriptor is AccessorForConstructorDescriptor) false else isAccessor(descriptor)
|
||||
}
|
||||
|
||||
private fun findAnyDeclaration(function: FunctionDescriptor): FunctionDescriptor {
|
||||
internal fun findAnyDeclaration(function: FunctionDescriptor): FunctionDescriptor {
|
||||
return if (function.kind == CallableMemberDescriptor.Kind.DECLARATION) {
|
||||
function
|
||||
} else findBaseDeclaration(function)
|
||||
|
||||
Reference in New Issue
Block a user