diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java index 192e4eceb11..2244066b24b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java @@ -181,7 +181,7 @@ public class AsmUtil { public static boolean isAbstractMethod(FunctionDescriptor functionDescriptor, OwnerKind kind, GenerationState state) { return (functionDescriptor.getModality() == Modality.ABSTRACT || - (isJvmInterface(functionDescriptor.getContainingDeclaration()) && !state.isJvm8Target())) + (isJvmInterface(functionDescriptor.getContainingDeclaration()) && !state.isJvm8TargetWithDefaults())) && !isStaticMethod(kind, functionDescriptor); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index b828a5805cd..745bb932659 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -99,7 +99,7 @@ public class FunctionCodegen { private final Function1 IS_PURE_INTERFACE_CHECKER = new Function1() { @Override public Boolean invoke(DeclarationDescriptor descriptor) { - return JvmCodegenUtil.isAnnotationOrJvm6Interface(descriptor, state); + return JvmCodegenUtil.isAnnotationOrJvmInterfaceWithoutDefaults(descriptor, state); } }; @@ -201,7 +201,7 @@ public class FunctionCodegen { generateBridges(functionDescriptor); - if (isJvm8InterfaceMember(functionDescriptor, state) && contextKind != OwnerKind.DEFAULT_IMPLS && state.getGenerateDefaultImplsForJvm8()) { + if (isJvm8InterfaceWithDefaultsMember(functionDescriptor, state) && contextKind != OwnerKind.DEFAULT_IMPLS && state.getGenerateDefaultImplsForJvm8()) { generateDelegateForDefaultImpl(functionDescriptor, origin.getElement()); } @@ -419,7 +419,7 @@ public class FunctionCodegen { generateFacadeDelegateMethodBody(mv, signature.getAsmMethod(), (MultifileClassFacadeContext) context.getParentContext()); methodEnd = new Label(); } - else if (OwnerKind.DEFAULT_IMPLS == context.getContextKind() && isJvm8InterfaceMember(functionDescriptor, parentCodegen.state)) { + else if (OwnerKind.DEFAULT_IMPLS == context.getContextKind() && isJvm8InterfaceWithDefaultsMember(functionDescriptor, parentCodegen.state)) { int flags = AsmUtil.getMethodAsmFlags(functionDescriptor, OwnerKind.DEFAULT_IMPLS, context.getState()); assert (flags & Opcodes.ACC_ABSTRACT) == 0 : "Interface method with body should be non-abstract" + functionDescriptor; Type type = typeMapper.mapOwner(functionDescriptor); @@ -724,7 +724,7 @@ public class FunctionCodegen { public void generateBridges(@NotNull FunctionDescriptor descriptor) { if (descriptor instanceof ConstructorDescriptor) return; if (owner.getContextKind() == OwnerKind.DEFAULT_IMPLS) return; - if (isAnnotationOrJvm6Interface(descriptor.getContainingDeclaration(), state)) return; + if (isAnnotationOrJvmInterfaceWithoutDefaults(descriptor.getContainingDeclaration(), state)) return; // equals(Any?), hashCode(), toString() never need bridges if (isMethodOfAny(descriptor)) return; @@ -1089,7 +1089,7 @@ public class FunctionCodegen { iv.invokespecial(parentInternalName, delegateTo.getName(), delegateTo.getDescriptor(), false); } else { - if (isJvm8InterfaceMember(descriptor, state)) { + if (isJvm8InterfaceWithDefaultsMember(descriptor, state)) { iv.invokeinterface(v.getThisName(), delegateTo.getName(), delegateTo.getDescriptor()); } else { @@ -1257,6 +1257,6 @@ public class FunctionCodegen { @NotNull GenerationState state ) { assert isInterface(contextClass) : "'processInterface' method should be called only for interfaces, but: " + contextClass; - return isJvm8Interface(contextClass, state) ? kind != OwnerKind.DEFAULT_IMPLS : kind == OwnerKind.DEFAULT_IMPLS; + return JvmCodegenUtil.isJvm8InterfaceWithDefaults(contextClass, state) ? kind != OwnerKind.DEFAULT_IMPLS : kind == OwnerKind.DEFAULT_IMPLS; } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index 1d029742820..0045f7abc34 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -233,7 +233,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { @Override protected void generateDefaultImplsIfNeeded() { - if (isInterface(descriptor) && !isLocal && (!isJvm8Interface(descriptor, state) || state.getGenerateDefaultImplsForJvm8())) { + if (isInterface(descriptor) && !isLocal && (!JvmCodegenUtil.isJvm8InterfaceWithDefaults(descriptor, state) || state.getGenerateDefaultImplsForJvm8())) { Type defaultImplsType = state.getTypeMapper().mapDefaultImpls(descriptor); ClassBuilder defaultImplsBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.DefaultImpls(myClass.getPsiOrParent(), descriptor), defaultImplsType, myClass.getContainingKtFile()); @@ -1293,14 +1293,14 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } private void generateTraitMethods() { - if (isAnnotationOrJvm6Interface(descriptor, state)) return; + if (isAnnotationOrJvmInterfaceWithoutDefaults(descriptor, state)) return; List restrictedInheritance = new ArrayList(); for (Map.Entry entry : CodegenUtil.getNonPrivateTraitMethods(descriptor).entrySet()) { FunctionDescriptor interfaceFun = entry.getKey(); //skip java 8 default methods - if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) && !isJvm8InterfaceMember(interfaceFun, state)) { - if (state.isJvm8Target() && !JvmCodegenUtil.isJvm8Interface(interfaceFun.getContainingDeclaration(), state)) { + if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) && !isJvm8InterfaceWithDefaultsMember(interfaceFun, state)) { + if (state.isJvm8TargetWithDefaults() && !JvmCodegenUtil.isJvm8InterfaceWithDefaults(interfaceFun.getContainingDeclaration(), state)) { restrictedInheritance.add(interfaceFun); } else { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java index db0a356b1ca..f6c115a86c5 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java @@ -30,8 +30,6 @@ import org.jetbrains.kotlin.codegen.context.MethodContext; import org.jetbrains.kotlin.codegen.context.RootContext; import org.jetbrains.kotlin.codegen.state.GenerationState; import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper; -import org.jetbrains.kotlin.config.LanguageFeature; -import org.jetbrains.kotlin.config.LanguageVersionSettings; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor; import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor; @@ -64,11 +62,11 @@ public class JvmCodegenUtil { private JvmCodegenUtil() { } - public static boolean isAnnotationOrJvm6Interface(@NotNull DeclarationDescriptor descriptor, @NotNull GenerationState state) { - return isAnnotationOrJvm6Interface(descriptor, state.isJvm8Target()); + public static boolean isAnnotationOrJvmInterfaceWithoutDefaults(@NotNull DeclarationDescriptor descriptor, @NotNull GenerationState state) { + return isAnnotationOrJvmInterfaceWithoutDefaults(descriptor, state.isJvm8Target(), state.isJvm8TargetWithDefaults()); } - public static boolean isAnnotationOrJvm6Interface(@NotNull DeclarationDescriptor descriptor, boolean isJvm8Target) { + private static boolean isAnnotationOrJvmInterfaceWithoutDefaults(@NotNull DeclarationDescriptor descriptor, boolean isJvm8Target, boolean isJvm8TargetWithDefaults) { if (!isJvmInterface(descriptor)) { return false; } @@ -80,23 +78,24 @@ public class JvmCodegenUtil { KotlinJvmBinaryClass binaryClass = ((KotlinJvmBinarySourceElement) source).getBinaryClass(); assert binaryClass instanceof FileBasedKotlinClass : "KotlinJvmBinaryClass should be subclass of FileBasedKotlinClass, but " + binaryClass; - return ((FileBasedKotlinClass) binaryClass).getClassVersion() == Opcodes.V1_6; + /*TODO need add some flags to compiled code*/ + return true || ((FileBasedKotlinClass) binaryClass).getClassVersion() == Opcodes.V1_6; } } - return !isJvm8Target; + return !isJvm8TargetWithDefaults; } - public static boolean isJvm8Interface(@NotNull DeclarationDescriptor descriptor, @NotNull GenerationState state) { - return isJvm8Interface(descriptor, state.isJvm8Target()); + public static boolean isJvm8InterfaceWithDefaults(@NotNull DeclarationDescriptor descriptor, @NotNull GenerationState state) { + return isJvm8InterfaceWithDefaults(descriptor, state.isJvm8Target(), state.isJvm8TargetWithDefaults()); } - public static boolean isJvm8Interface(@NotNull DeclarationDescriptor descriptor, boolean isJvm8Target) { - return DescriptorUtils.isInterface(descriptor) && !isAnnotationOrJvm6Interface(descriptor, isJvm8Target); + public static boolean isJvm8InterfaceWithDefaults(@NotNull DeclarationDescriptor descriptor, boolean isJvm8Target, boolean isJvm8TargetWithDefaults) { + return DescriptorUtils.isInterface(descriptor) && !isAnnotationOrJvmInterfaceWithoutDefaults(descriptor, isJvm8Target, isJvm8TargetWithDefaults); } - public static boolean isJvm8InterfaceMember(@NotNull CallableMemberDescriptor descriptor, @NotNull GenerationState state) { + public static boolean isJvm8InterfaceWithDefaultsMember(@NotNull CallableMemberDescriptor descriptor, @NotNull GenerationState state) { DeclarationDescriptor declaration = descriptor.getContainingDeclaration(); - return isJvm8Interface(declaration, state); + return isJvm8InterfaceWithDefaults(declaration, state); } public static boolean isJvmInterface(DeclarationDescriptor descriptor) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java index 50e68cc7082..2f5817ae33c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java @@ -66,7 +66,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method; import java.util.*; import static org.jetbrains.kotlin.codegen.AsmUtil.*; -import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvm8InterfaceMember; +import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvm8InterfaceWithDefaultsMember; import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED; import static org.jetbrains.kotlin.resolve.BindingContext.*; import static org.jetbrains.kotlin.resolve.DescriptorUtils.*; @@ -377,7 +377,7 @@ public abstract class MemberCodegen Unit>() diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 7e432b73542..3ce5d5b288d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -125,6 +125,7 @@ class GenerationState @JvmOverloads constructor( } val isJvm8Target: Boolean = configuration.get(JVMConfigurationKeys.JVM_TARGET) == JvmTarget.JVM_1_8 + val isJvm8TargetWithDefaults: Boolean = isJvm8Target && configuration.getBoolean(JVMConfigurationKeys.JVM8_TARGET_WITH_DEFAULTS) val generateDefaultImplsForJvm8: Boolean = configuration.getBoolean(JVMConfigurationKeys.INTERFACE_COMPATIBILITY) val moduleName: String = moduleName ?: JvmCodegenUtil.getModuleName(module) @@ -134,7 +135,7 @@ class GenerationState @JvmOverloads constructor( val bindingContext: BindingContext = bindingTrace.bindingContext val typeMapper: KotlinTypeMapper = KotlinTypeMapper( this.bindingContext, classBuilderMode, fileClassesProvider, IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace), - this.moduleName, isJvm8Target + this.moduleName, isJvm8Target, isJvm8TargetWithDefaults ) val intrinsics: IntrinsicMethods = IntrinsicMethods() val samWrapperClasses: SamWrapperClasses = SamWrapperClasses(this) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java index c54ad850ee8..c453b7bcf01 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java @@ -98,6 +98,7 @@ public class KotlinTypeMapper { private final IncompatibleClassTracker incompatibleClassTracker; private final String moduleName; private final boolean isJvm8Target; + private final boolean isJvm8TargetWithDefaults; private final TypeMappingConfiguration typeMappingConfiguration = new TypeMappingConfiguration() { private final Function2 defaultClassNameFactory @@ -153,7 +154,8 @@ public class KotlinTypeMapper { @NotNull JvmFileClassesProvider fileClassesProvider, @NotNull IncompatibleClassTracker incompatibleClassTracker, @NotNull String moduleName, - boolean isJvm8Target + boolean isJvm8Target, + boolean isJvm8TargetWithDefaults ) { this.bindingContext = bindingContext; this.classBuilderMode = classBuilderMode; @@ -161,6 +163,7 @@ public class KotlinTypeMapper { this.incompatibleClassTracker = incompatibleClassTracker; this.moduleName = moduleName; this.isJvm8Target = isJvm8Target; + this.isJvm8TargetWithDefaults = isJvm8TargetWithDefaults; } @NotNull @@ -682,7 +685,7 @@ public class KotlinTypeMapper { descriptor = classCallable; continue; } - else if (isSuperCall && !isJvm8Target && !isInterface(descriptor.getContainingDeclaration())) { + else if (isSuperCall && !isJvm8TargetWithDefaults && !isInterface(descriptor.getContainingDeclaration())) { //Don't unwrap fake overrides from class to interface cause substituted override would be implicitly generated for target 1.6 return descriptor; } @@ -738,12 +741,12 @@ public class KotlinTypeMapper { baseMethodDescriptor = findBaseDeclaration(functionDescriptor).getOriginal(); ClassDescriptor ownerForDefault = (ClassDescriptor) baseMethodDescriptor.getContainingDeclaration(); ownerForDefaultImpl = - isJvmInterface(ownerForDefault) && !isJvm8Interface(ownerForDefault) ? + isJvmInterface(ownerForDefault) && !isJvm8InterfaceWithDefaults(ownerForDefault) ? mapDefaultImpls(ownerForDefault) : mapClass(ownerForDefault); if (isInterface && (superCall || descriptor.getVisibility() == Visibilities.PRIVATE || isAccessor(descriptor))) { thisClass = mapClass(currentOwner); - if (declarationOwner instanceof JavaClassDescriptor || isJvm8Interface(declarationOwner)) { + if (declarationOwner instanceof JavaClassDescriptor || isJvm8InterfaceWithDefaults(declarationOwner)) { invokeOpcode = INVOKESPECIAL; signature = mapSignatureSkipGeneric(functionDescriptor); owner = thisClass; @@ -782,7 +785,6 @@ public class KotlinTypeMapper { signature = mapSignatureSkipGeneric(functionToCall); - /*TODO: isInterfaceMember?*/ ClassDescriptor receiver = (currentIsInterface && !originalIsInterface) || currentOwner instanceof FunctionClassDescriptor ? declarationOwner : currentOwner; @@ -828,8 +830,9 @@ public class KotlinTypeMapper { isJvm8Target ? isInterfaceMember : invokeOpcode == INVOKEINTERFACE ); } - private boolean isJvm8Interface(@NotNull ClassDescriptor ownerForDefault) { - return isJvmInterface(ownerForDefault) && JvmCodegenUtil.isJvm8Interface(ownerForDefault, isJvm8Target); + private boolean isJvm8InterfaceWithDefaults(@NotNull ClassDescriptor ownerForDefault) { + return isJvmInterface(ownerForDefault) && + JvmCodegenUtil.isJvm8InterfaceWithDefaults(ownerForDefault, isJvm8Target, isJvm8TargetWithDefaults); } public static boolean isAccessor(@NotNull CallableMemberDescriptor descriptor) { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java b/compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java index 1dadfafec5f..f33d2d75965 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java @@ -87,6 +87,9 @@ public class JVMConfigurationKeys { public static final CompilerConfigurationKey INTERFACE_COMPATIBILITY = CompilerConfigurationKey.create("Generate additional 'DefaultImpls' class files for jvm 8 target for compatibility with 6 target interfaces"); + public static final CompilerConfigurationKey JVM8_TARGET_WITH_DEFAULTS = + CompilerConfigurationKey.create("Generate default methods in interfaces"); + public static final CompilerConfigurationKey INCREMENTAL_COMPILATION_COMPONENTS = CompilerConfigurationKey.create("incremental cache provider"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt index 56065fb2560..d4d97a08b82 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt @@ -61,12 +61,12 @@ class BridgeLowering(val state: GenerationState) : ClassLoweringPass { val typeMapper = state.typeMapper private val IS_PURE_INTERFACE_CHECKER = fun(descriptor: DeclarationDescriptor): Boolean { - return JvmCodegenUtil.isAnnotationOrJvm6Interface(descriptor, state) + return JvmCodegenUtil.isAnnotationOrJvmInterfaceWithoutDefaults(descriptor, state) } override fun lower(irClass: IrClass) { val classDescriptor = irClass.descriptor - if (JvmCodegenUtil.isAnnotationOrJvm6Interface(classDescriptor, state) || classDescriptor is FileClassDescriptor) return + if (JvmCodegenUtil.isAnnotationOrJvmInterfaceWithoutDefaults(classDescriptor, state) || classDescriptor is FileClassDescriptor) return if (classDescriptor is DefaultImplsClassDescriptor) { return /*TODO?*/ diff --git a/compiler/testData/codegen/java8/box/jvm8/bridgeInClass.kt b/compiler/testData/codegen/java8/box/jvm8/bridgeInClass.kt index 19c3d4f5049..4cda1ff96c9 100644 --- a/compiler/testData/codegen/java8/box/jvm8/bridgeInClass.kt +++ b/compiler/testData/codegen/java8/box/jvm8/bridgeInClass.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { fun test(p: T): T { diff --git a/compiler/testData/codegen/java8/box/jvm8/bridgeInInterface.kt b/compiler/testData/codegen/java8/box/jvm8/bridgeInInterface.kt index 60ab59533fc..450e27941bc 100644 --- a/compiler/testData/codegen/java8/box/jvm8/bridgeInInterface.kt +++ b/compiler/testData/codegen/java8/box/jvm8/bridgeInInterface.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { fun test(p: T): T { diff --git a/compiler/testData/codegen/java8/box/jvm8/defaultArgs.kt b/compiler/testData/codegen/java8/box/jvm8/defaultArgs.kt index 7ece71ad052..6f122836584 100644 --- a/compiler/testData/codegen/java8/box/jvm8/defaultArgs.kt +++ b/compiler/testData/codegen/java8/box/jvm8/defaultArgs.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Z { fun test(s: String = "OK"): String { diff --git a/compiler/testData/codegen/java8/box/jvm8/diamond.kt b/compiler/testData/codegen/java8/box/jvm8/diamond.kt index 139cc6f3f30..6817ed96c0a 100644 --- a/compiler/testData/codegen/java8/box/jvm8/diamond.kt +++ b/compiler/testData/codegen/java8/box/jvm8/diamond.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_REFLECT // FULL_JDK diff --git a/compiler/testData/codegen/java8/box/jvm8/kt11969.kt b/compiler/testData/codegen/java8/box/jvm8/kt11969.kt index 5a3810cb5e2..f33682a7ec4 100644 --- a/compiler/testData/codegen/java8/box/jvm8/kt11969.kt +++ b/compiler/testData/codegen/java8/box/jvm8/kt11969.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_RUNTIME // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/java8/box/jvm8/kt14243.kt b/compiler/testData/codegen/java8/box/jvm8/kt14243.kt index bd836e9850e..20f0a5726ab 100644 --- a/compiler/testData/codegen/java8/box/jvm8/kt14243.kt +++ b/compiler/testData/codegen/java8/box/jvm8/kt14243.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Z { fun test(p: T): T { diff --git a/compiler/testData/codegen/java8/box/jvm8/kt14243_2.kt b/compiler/testData/codegen/java8/box/jvm8/kt14243_2.kt index 5983dff22dc..c78115ffe47 100644 --- a/compiler/testData/codegen/java8/box/jvm8/kt14243_2.kt +++ b/compiler/testData/codegen/java8/box/jvm8/kt14243_2.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Z { fun test(p: T): T { diff --git a/compiler/testData/codegen/java8/box/jvm8/kt14243_prop.kt b/compiler/testData/codegen/java8/box/jvm8/kt14243_prop.kt index 3053ee099b5..27d8cc319e2 100644 --- a/compiler/testData/codegen/java8/box/jvm8/kt14243_prop.kt +++ b/compiler/testData/codegen/java8/box/jvm8/kt14243_prop.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Z { val value: T diff --git a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInClass.kt b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInClass.kt index 03c811f4a24..5d31e16b4a4 100644 --- a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInClass.kt +++ b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInClass.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_RUNTIME // FULL_JDK interface Test { diff --git a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface.kt b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface.kt index 477e82dfdcb..bc8e629cb52 100644 --- a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface.kt +++ b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_RUNTIME // FULL_JDK interface Test { diff --git a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface2.kt b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface2.kt index 149d822cefa..7feafaf0992 100644 --- a/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface2.kt +++ b/compiler/testData/codegen/java8/box/jvm8/noDelegation/noDelegationToDefaultMethodInInterface2.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_RUNTIME // FULL_JDK diff --git a/compiler/testData/codegen/java8/box/jvm8/oneImplementation.kt b/compiler/testData/codegen/java8/box/jvm8/oneImplementation.kt index 54c1c1856c9..eb3cd929267 100644 --- a/compiler/testData/codegen/java8/box/jvm8/oneImplementation.kt +++ b/compiler/testData/codegen/java8/box/jvm8/oneImplementation.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface KCallable { val returnType: String } diff --git a/compiler/testData/codegen/java8/box/jvm8/oneImplementation2.kt b/compiler/testData/codegen/java8/box/jvm8/oneImplementation2.kt index d589a769929..c616545e0c8 100644 --- a/compiler/testData/codegen/java8/box/jvm8/oneImplementation2.kt +++ b/compiler/testData/codegen/java8/box/jvm8/oneImplementation2.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface KCallable { val returnType: String } diff --git a/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotations.kt b/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotations.kt index 3953c299174..38b869cfcd2 100644 --- a/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotations.kt +++ b/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotations.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // WITH_REFLECT annotation class Property(val value: String) diff --git a/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotationsCompatibility.kt b/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotationsCompatibility.kt index 65b9f581607..415e1d83135 100644 --- a/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotationsCompatibility.kt +++ b/compiler/testData/codegen/java8/box/jvm8/reflection/propertyAnnotationsCompatibility.kt @@ -1,6 +1,6 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS, +JVM.INTERFACE_COMPATIBILITY // WITH_REFLECT -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY annotation class Property(val value: String) annotation class Accessor(val value: String) diff --git a/compiler/testData/codegen/java8/box/jvm8/simpleCall.kt b/compiler/testData/codegen/java8/box/jvm8/simpleCall.kt index 33575361a09..99507f77a55 100644 --- a/compiler/testData/codegen/java8/box/jvm8/simpleCall.kt +++ b/compiler/testData/codegen/java8/box/jvm8/simpleCall.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { fun test(): String { diff --git a/compiler/testData/codegen/java8/box/jvm8/simpleProperty.kt b/compiler/testData/codegen/java8/box/jvm8/simpleProperty.kt index e98f05ed57a..3d8cee11448 100644 --- a/compiler/testData/codegen/java8/box/jvm8/simpleProperty.kt +++ b/compiler/testData/codegen/java8/box/jvm8/simpleProperty.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Z { val z: String; diff --git a/compiler/testData/codegen/java8/box/jvm8/superCall.kt b/compiler/testData/codegen/java8/box/jvm8/superCall.kt index 6bff699ec15..803f6be1412 100644 --- a/compiler/testData/codegen/java8/box/jvm8/superCall.kt +++ b/compiler/testData/codegen/java8/box/jvm8/superCall.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { diff --git a/compiler/testData/codegen/java8/box/mapRemove/noDefaultImpls.kt b/compiler/testData/codegen/java8/box/mapRemove/noDefaultImpls.kt index ba393324638..842710f905a 100644 --- a/compiler/testData/codegen/java8/box/mapRemove/noDefaultImpls.kt +++ b/compiler/testData/codegen/java8/box/mapRemove/noDefaultImpls.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS // FULL_JDK // There should be no DefaultImpls method for MutableMap.remove(K;V) diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInClass.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInClass.kt index f97127e0561..d80713f1e46 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInClass.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInClass.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS class TestClass : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface.kt index de1dba8206b..c20f369822d 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test2 : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface2.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface2.kt index 7fb6b0d3c80..a829d1e9bbf 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface2.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/delegationToDefaultMethodInInterface2.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test2 : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond.kt index 2196db723a3..c6445e323ec 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test2 : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond2.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond2.kt index becdbfbd562..b81bafca4ae 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond2.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond2.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS open class TestClass : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond3.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond3.kt index a4c4705b07e..880cb11479b 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond3.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/delegation/diamond3.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS abstract class TestClass : Test { abstract override fun test(): String } diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCall.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCall.kt index eceedef8df0..746a9318fbd 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCall.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCall.kt @@ -8,6 +8,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS class TestClass : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCallWithHierarchy.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCallWithHierarchy.kt index 08bb16c4aba..bcb7f0d0a4d 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCallWithHierarchy.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleCallWithHierarchy.kt @@ -8,6 +8,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test2 : Test { override fun test(): String { return super.test() diff --git a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleProp.kt b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleProp.kt index ce7cdd97a93..5238cbc7951 100644 --- a/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleProp.kt +++ b/compiler/testData/codegen/java8/compileKotlinAgainstKotlin/jvm8against6/simpleProp.kt @@ -7,6 +7,7 @@ interface Test { // FILE: 2.kt // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS class TestClass : Test { override val test: String get() = super.test diff --git a/compiler/testData/codegen/java8/writeFlags/defaultMethod.kt b/compiler/testData/codegen/java8/writeFlags/defaults/defaultMethod.kt similarity index 83% rename from compiler/testData/codegen/java8/writeFlags/defaultMethod.kt rename to compiler/testData/codegen/java8/writeFlags/defaults/defaultMethod.kt index aa5b4b37b2a..729867e5828 100644 --- a/compiler/testData/codegen/java8/writeFlags/defaultMethod.kt +++ b/compiler/testData/codegen/java8/writeFlags/defaults/defaultMethod.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { fun test(): String { diff --git a/compiler/testData/codegen/java8/writeFlags/defaultMethodCompatibility.kt b/compiler/testData/codegen/java8/writeFlags/defaults/defaultMethodCompatibility.kt similarity index 84% rename from compiler/testData/codegen/java8/writeFlags/defaultMethodCompatibility.kt rename to compiler/testData/codegen/java8/writeFlags/defaults/defaultMethodCompatibility.kt index 88535be722c..1ff1d4bf485 100644 --- a/compiler/testData/codegen/java8/writeFlags/defaultMethodCompatibility.kt +++ b/compiler/testData/codegen/java8/writeFlags/defaults/defaultMethodCompatibility.kt @@ -1,6 +1,5 @@ // JVM_TARGET: 1.8 -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY - +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS, +JVM.INTERFACE_COMPATIBILITY interface Test { fun test(): String { diff --git a/compiler/testData/codegen/java8/writeFlags/defaultProperty.kt b/compiler/testData/codegen/java8/writeFlags/defaults/defaultProperty.kt similarity index 81% rename from compiler/testData/codegen/java8/writeFlags/defaultProperty.kt rename to compiler/testData/codegen/java8/writeFlags/defaults/defaultProperty.kt index b35aad76cf0..796d255c3be 100644 --- a/compiler/testData/codegen/java8/writeFlags/defaultProperty.kt +++ b/compiler/testData/codegen/java8/writeFlags/defaults/defaultProperty.kt @@ -1,4 +1,5 @@ // JVM_TARGET: 1.8 +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS interface Test { var z: String diff --git a/compiler/testData/codegen/java8/writeFlags/defaultPropertyCompatibility.kt b/compiler/testData/codegen/java8/writeFlags/defaults/defaultPropertyCompatibility.kt similarity index 90% rename from compiler/testData/codegen/java8/writeFlags/defaultPropertyCompatibility.kt rename to compiler/testData/codegen/java8/writeFlags/defaults/defaultPropertyCompatibility.kt index 5ce5c3805c5..e77741e3219 100644 --- a/compiler/testData/codegen/java8/writeFlags/defaultPropertyCompatibility.kt +++ b/compiler/testData/codegen/java8/writeFlags/defaults/defaultPropertyCompatibility.kt @@ -1,5 +1,5 @@ // JVM_TARGET: 1.8 -// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY +// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM8_TARGET_WITH_DEFAULTS, +JVM.INTERFACE_COMPATIBILITY interface Test { var z: String diff --git a/compiler/testData/codegen/java8/writeFlags/interfaceMethod.kt b/compiler/testData/codegen/java8/writeFlags/interfaceMethod.kt new file mode 100644 index 00000000000..dfd3e07469f --- /dev/null +++ b/compiler/testData/codegen/java8/writeFlags/interfaceMethod.kt @@ -0,0 +1,17 @@ +// JVM_TARGET: 1.8 + +interface Test { + fun test(): String { + return "OK" + } + + fun testAbstract(): String +} + +// TESTED_OBJECT_KIND: function +// TESTED_OBJECTS: Test, test +// FLAGS: ACC_PUBLIC, ACC_ABSTRACT + +// TESTED_OBJECT_KIND: function +// TESTED_OBJECTS: Test, testAbstract +// FLAGS: ACC_PUBLIC, ACC_ABSTRACT diff --git a/compiler/testData/codegen/java8/writeFlags/interfaceProperty.kt b/compiler/testData/codegen/java8/writeFlags/interfaceProperty.kt new file mode 100644 index 00000000000..92a063907da --- /dev/null +++ b/compiler/testData/codegen/java8/writeFlags/interfaceProperty.kt @@ -0,0 +1,15 @@ +// JVM_TARGET: 1.8 + +interface Test { + var z: String + get() = "OK" + set(value) {} +} + +// TESTED_OBJECT_KIND: function +// TESTED_OBJECTS: Test, getZ +// FLAGS: ACC_PUBLIC, ACC_ABSTRACT + +// TESTED_OBJECT_KIND: function +// TESTED_OBJECTS: Test, setZ +// FLAGS: ACC_PUBLIC, ACC_ABSTRACT diff --git a/compiler/tests-java8/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java b/compiler/tests-java8/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java index 5e8d7398c14..d654ef8cf7e 100644 --- a/compiler/tests-java8/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java +++ b/compiler/tests-java8/tests/org/jetbrains/kotlin/codegen/flags/WriteFlagsTestGenerated.java @@ -36,27 +36,48 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/writeFlags"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("defaultMethod.kt") - public void testDefaultMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaultMethod.kt"); + @TestMetadata("interfaceMethod.kt") + public void testInterfaceMethod() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/interfaceMethod.kt"); doTest(fileName); } - @TestMetadata("defaultMethodCompatibility.kt") - public void testDefaultMethodCompatibility() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaultMethodCompatibility.kt"); + @TestMetadata("interfaceProperty.kt") + public void testInterfaceProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/interfaceProperty.kt"); doTest(fileName); } - @TestMetadata("defaultProperty.kt") - public void testDefaultProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaultProperty.kt"); - doTest(fileName); - } + @TestMetadata("compiler/testData/codegen/java8/writeFlags/defaults") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Defaults extends AbstractWriteFlagsTest { + public void testAllFilesPresentInDefaults() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/writeFlags/defaults"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } - @TestMetadata("defaultPropertyCompatibility.kt") - public void testDefaultPropertyCompatibility() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaultPropertyCompatibility.kt"); - doTest(fileName); + @TestMetadata("defaultMethod.kt") + public void testDefaultMethod() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaults/defaultMethod.kt"); + doTest(fileName); + } + + @TestMetadata("defaultMethodCompatibility.kt") + public void testDefaultMethodCompatibility() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaults/defaultMethodCompatibility.kt"); + doTest(fileName); + } + + @TestMetadata("defaultProperty.kt") + public void testDefaultProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaults/defaultProperty.kt"); + doTest(fileName); + } + + @TestMetadata("defaultPropertyCompatibility.kt") + public void testDefaultPropertyCompatibility() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/writeFlags/defaults/defaultPropertyCompatibility.kt"); + doTest(fileName); + } } } diff --git a/plugins/annotation-processing/src/org/jetbrains/kotlin/annotation/processing/AnnotationProcessingExtension.kt b/plugins/annotation-processing/src/org/jetbrains/kotlin/annotation/processing/AnnotationProcessingExtension.kt index b7c5bd99c2f..250f0ff1ba9 100755 --- a/plugins/annotation-processing/src/org/jetbrains/kotlin/annotation/processing/AnnotationProcessingExtension.kt +++ b/plugins/annotation-processing/src/org/jetbrains/kotlin/annotation/processing/AnnotationProcessingExtension.kt @@ -196,7 +196,7 @@ abstract class AbstractAnnotationProcessingExtension( private fun KotlinProcessingEnvironment.createTypeMapper(): KotlinTypeMapper { return KotlinTypeMapper(bindingContext(), ClassBuilderMode.full(false), NoResolveFileClassesProvider, - IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false) + IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false, false) } private fun KotlinProcessingEnvironment.doAnnotationProcessing(files: Collection): ProcessingResult { diff --git a/plugins/uast-kotlin-idea/src/IdeaKotlinUastBindingContextProviderService.kt b/plugins/uast-kotlin-idea/src/IdeaKotlinUastBindingContextProviderService.kt index 4c2c702f96f..b57f23c0831 100644 --- a/plugins/uast-kotlin-idea/src/IdeaKotlinUastBindingContextProviderService.kt +++ b/plugins/uast-kotlin-idea/src/IdeaKotlinUastBindingContextProviderService.kt @@ -31,7 +31,7 @@ class IdeaKotlinUastBindingContextProviderService : KotlinUastBindingContextProv override fun getTypeMapper(element: KtElement): KotlinTypeMapper? { return KotlinTypeMapper(getBindingContext(element), - ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, - IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false) + ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, + IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false, false) } } \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/CliKotlinUastBindingContextProviderService.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/CliKotlinUastBindingContextProviderService.kt index ee47bd6b5c2..3277e179548 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/CliKotlinUastBindingContextProviderService.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/internal/CliKotlinUastBindingContextProviderService.kt @@ -41,7 +41,7 @@ class UastAnalysisHandlerExtension : AnalysisHandlerExtension { val bindingContext = context ?: return null val typeMapper = KotlinTypeMapper(bindingContext, ClassBuilderMode.LIGHT_CLASSES, NoResolveFileClassesProvider, - IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false) + IncompatibleClassTracker.DoNothing, JvmAbi.DEFAULT_MODULE_NAME, false, false) this.typeMapper = typeMapper return typeMapper }