Generate 'DefaultImpls' for jvm 8 target only within compiler option
This commit is contained in:
+1
@@ -10,6 +10,7 @@ where advanced options include:
|
||||
-Xdump-declarations-to <path> Path to JSON file to dump Java to Kotlin declaration mappings
|
||||
-Xload-script-configs Load script configuration files from project directory tree
|
||||
-Xsingle-module Combine modules for source files and binary dependencies into a single module
|
||||
-Xinterface-compatibility Generate DefaultImpls classes for interfaces in JVM target bytecode version 1.8 for binary compatibility with 1.6
|
||||
-Xno-inline Disable method inlining
|
||||
-Xrepeat <count> Repeat compilation (for performance analysis)
|
||||
-Xplugin <path> Load plugins from the given classpath
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_REFLECT
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY
|
||||
|
||||
annotation class Property(val value: String)
|
||||
annotation class Accessor(val value: String)
|
||||
|
||||
interface Z {
|
||||
@Property("OK")
|
||||
val z: String;
|
||||
@Accessor("OK")
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
|
||||
class Test : Z
|
||||
|
||||
fun box() : String {
|
||||
val value = (Z::z.annotations.single() as Property).value
|
||||
if (value != "OK") return value
|
||||
val forName = Class.forName("Z\$DefaultImpls")
|
||||
val annotation = forName.getDeclaredMethod("z\$annotations").getAnnotation(Property::class.java)
|
||||
return annotation.value
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY
|
||||
|
||||
|
||||
interface Test {
|
||||
fun test(): String {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, test
|
||||
// FLAGS: ACC_PUBLIC
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, test$defaultImpl
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
// TESTED_OBJECT_KIND: class
|
||||
// TESTED_OBJECTS: Test$DefaultImpls
|
||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test$DefaultImpls, test
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC
|
||||
@@ -0,0 +1,37 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.INTERFACE_COMPATIBILITY
|
||||
|
||||
interface Test {
|
||||
var z: String
|
||||
get() = "OK"
|
||||
set(value) {}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, getZ
|
||||
// FLAGS: ACC_PUBLIC
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, setZ
|
||||
// FLAGS: ACC_PUBLIC
|
||||
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, getZ$defaultImpl
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, setZ$defaultImpl
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
// TESTED_OBJECT_KIND: class
|
||||
// TESTED_OBJECTS: Test$DefaultImpls
|
||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test$DefaultImpls, getZ
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test$DefaultImpls, setZ
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC
|
||||
@@ -1,15 +0,0 @@
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
interface Test {
|
||||
fun a() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: class
|
||||
// TESTED_OBJECTS: Test$DefaultImpls
|
||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
|
||||
|
||||
// TESTED_OBJECT_KIND: class
|
||||
// TESTED_OBJECTS: Test
|
||||
// FLAGS: ACC_PUBLIC, ACC_ABSTRACT, ACC_INTERFACE
|
||||
Reference in New Issue
Block a user