Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
477cca3c
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
477cca3c
编写于
6月 08, 2020
作者:
M
Mikhail Bogdanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add JvmDefaultWithoutCompatibility annotation
上级
a98ad79d
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
207 addition
and
6 deletion
+207
-6
compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
...fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
+28
-0
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt
...etbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt
+13
-2
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
...tlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
+2
-2
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
...g/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
+2
-2
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.fir.kt
.../jvmDefault/jvmDefaultWithoutCompatibility/target6.fir.kt
+7
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt
...ions/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt
+7
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.txt
...ons/jvmDefault/jvmDefaultWithoutCompatibility/target6.txt
+14
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt
...ions/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt
+10
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.txt
...ons/jvmDefault/jvmDefaultWithoutCompatibility/target8.txt
+16
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.fir.kt
...ult/jvmDefaultWithoutCompatibility/target8Disabled.fir.kt
+9
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt
...Default/jvmDefaultWithoutCompatibility/target8Disabled.kt
+9
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.txt
...efault/jvmDefaultWithoutCompatibility/target8Disabled.txt
+16
-0
compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
...s/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
+28
-0
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
...s/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
+28
-0
libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt
libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt
+15
-0
libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
...tor/reference-public-api/kotlin-stdlib-runtime-merged.txt
+3
-0
未找到文件。
compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
浏览文件 @
477cca3c
...
...
@@ -561,6 +561,34 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt"
);
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
)
@TestDataPath
(
"$PROJECT_ROOT"
)
@RunWith
(
JUnit3RunnerWithInners
.
class
)
public
static
class
JvmDefaultWithoutCompatibility
extends
AbstractFirOldFrontendDiagnosticsTestWithStdlib
{
private
void
runTest
(
String
testDataFilePath
)
throws
Exception
{
KotlinTestUtils
.
runTest
(
this
::
doTest
,
this
,
testDataFilePath
);
}
public
void
testAllFilesPresentInJvmDefaultWithoutCompatibility
()
throws
Exception
{
KotlinTestUtils
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
Pattern
.
compile
(
"^(.+)\\.fir\\.kts?$"
),
true
);
}
@TestMetadata
(
"target6.kt"
)
public
void
testTarget6
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt"
);
}
@TestMetadata
(
"target8.kt"
)
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt"
);
}
@TestMetadata
(
"target8Disabled.kt"
)
public
void
testTarget8Disabled
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt"
);
}
}
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField"
)
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt
浏览文件 @
477cca3c
...
...
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.resolve.OverridingUtil
import
org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
import
org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
import
org.jetbrains.kotlin.resolve.jvm.annotations.JVM_DEFAULT_FQ_NAME
import
org.jetbrains.kotlin.resolve.jvm.annotations.JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME
import
org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault
import
org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
...
...
@@ -31,9 +32,19 @@ class JvmDefaultChecker(val jvmTarget: JvmTarget) : DeclarationChecker {
if
(!
DescriptorUtils
.
isInterface
(
descriptor
.
containingDeclaration
))
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_NOT_IN_INTERFACE
.
on
(
reportOn
))
}
else
if
(
jvmTarget
==
JvmTarget
.
JVM_1_6
)
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_JVM6_TARGET
.
on
(
reportOn
))
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_JVM6_TARGET
.
on
(
reportOn
,
"JvmDefault"
))
}
else
if
(!
jvmDefaultMode
.
isEnabled
)
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_DECLARATION
.
on
(
declaration
))
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_DECLARATION
.
on
(
declaration
,
"JvmDefault"
))
}
return
@check
}
descriptor
.
annotations
.
findAnnotation
(
JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME
)
?.
let
{
annotationDescriptor
->
val
reportOn
=
DescriptorToSourceUtils
.
getSourceFromAnnotation
(
annotationDescriptor
)
?:
declaration
if
(
jvmTarget
==
JvmTarget
.
JVM_1_6
)
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_JVM6_TARGET
.
on
(
reportOn
,
"JvmDefaultWithoutCompatibility"
))
}
else
if
(!
jvmDefaultMode
.
isEnabled
)
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_DEFAULT_IN_DECLARATION
.
on
(
reportOn
,
"JvmDefaultWithoutCompatibility"
))
}
return
@check
}
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
浏览文件 @
477cca3c
...
...
@@ -135,9 +135,9 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
"See https://youtrack.jetbrains.com/issue/KT-21354 for more details"
);
MAP
.
put
(
JVM_DEFAULT_NOT_IN_INTERFACE
,
"'@JvmDefault' is only supported on interface members"
);
MAP
.
put
(
JVM_DEFAULT_IN_JVM6_TARGET
,
"'
@JvmDefault' is only supported since JVM target 1.8. Recompile with '-jvm-target 1.8'"
);
MAP
.
put
(
JVM_DEFAULT_IN_JVM6_TARGET
,
"'
'@{0}'' is only supported since JVM target 1.8. Recompile with ''-jvm-target 1.8''"
,
STRING
);
MAP
.
put
(
JVM_DEFAULT_REQUIRED_FOR_OVERRIDE
,
"'@JvmDefault' is required for an override of a '@JvmDefault' member"
);
MAP
.
put
(
JVM_DEFAULT_IN_DECLARATION
,
"Usage of '
@JvmDefault' is only allowed with -Xjvm-default option"
);
MAP
.
put
(
JVM_DEFAULT_IN_DECLARATION
,
"Usage of '
'@{0}'' is only allowed with -Xjvm-default option"
,
STRING
);
MAP
.
put
(
JVM_DEFAULT_THROUGH_INHERITANCE
,
"Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option"
);
MAP
.
put
(
USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL
,
"Super calls of '@JvmDefault' members are only allowed with -Xjvm-default option"
);
MAP
.
put
(
NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT
,
"Non-@JvmDefault interface method cannot override default Java method. Please annotate this method with @JvmDefault"
);
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
浏览文件 @
477cca3c
...
...
@@ -108,9 +108,9 @@ public interface ErrorsJvm {
DiagnosticFactory0
<
KtExpression
>
ASSIGNMENT_TO_ARRAY_LOOP_VARIABLE
=
DiagnosticFactory0
.
create
(
WARNING
);
DiagnosticFactory0
<
PsiElement
>
JVM_DEFAULT_NOT_IN_INTERFACE
=
DiagnosticFactory0
.
create
(
ERROR
);
DiagnosticFactory
0
<
PsiElement
>
JVM_DEFAULT_IN_JVM6_TARGET
=
DiagnosticFactory0
.
create
(
ERROR
);
DiagnosticFactory
1
<
PsiElement
,
String
>
JVM_DEFAULT_IN_JVM6_TARGET
=
DiagnosticFactory1
.
create
(
ERROR
);
DiagnosticFactory0
<
KtDeclaration
>
JVM_DEFAULT_REQUIRED_FOR_OVERRIDE
=
DiagnosticFactory0
.
create
(
ERROR
,
DECLARATION_SIGNATURE
);
DiagnosticFactory
0
<
KtDeclaration
>
JVM_DEFAULT_IN_DECLARATION
=
DiagnosticFactory0
.
create
(
ERROR
,
DECLARATION_SIGNATURE
);
DiagnosticFactory
1
<
KtElement
,
String
>
JVM_DEFAULT_IN_DECLARATION
=
DiagnosticFactory1
.
create
(
ERROR
,
DECLARATION_SIGNATURE_OR_DEFAULT
);
DiagnosticFactory0
<
KtDeclaration
>
JVM_DEFAULT_THROUGH_INHERITANCE
=
DiagnosticFactory0
.
create
(
ERROR
,
DECLARATION_SIGNATURE
);
DiagnosticFactory0
<
PsiElement
>
USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL
=
DiagnosticFactory0
.
create
(
ERROR
);
...
...
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.fir.kt
0 → 100644
浏览文件 @
477cca3c
// !JVM_TARGET: 1.6
@JvmDefaultWithoutCompatibility
interface
A
{}
@JvmDefaultWithoutCompatibility
class
B
:
A
{}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt
0 → 100644
浏览文件 @
477cca3c
// !JVM_TARGET: 1.6
<!
JVM_DEFAULT_IN_JVM6_TARGET
!>
@JvmDefaultWithoutCompatibility
<!>
interface
A
{}
<!
JVM_DEFAULT_IN_JVM6_TARGET
!>
@JvmDefaultWithoutCompatibility
<!>
class
B
:
A
{}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.txt
0 → 100644
浏览文件 @
477cca3c
package
@kotlin.jvm.JvmDefaultWithoutCompatibility public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmDefaultWithoutCompatibility public final class B : A {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt
0 → 100644
浏览文件 @
477cca3c
// FIR_IDENTICAL
// !JVM_TARGET: 1.8
// !JVM_DEFAULT_MODE: all-compatibility
@JvmDefaultWithoutCompatibility
interface
A
<
T
>
{
fun
test
(
p
:
T
)
{}
}
class
B
:
A
<
String
>
{}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.txt
0 → 100644
浏览文件 @
477cca3c
package
@kotlin.jvm.JvmDefaultWithoutCompatibility public interface A</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open fun test(/*0*/ p: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class B : A<kotlin.String> {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun test(/*0*/ p: kotlin.String): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.fir.kt
0 → 100644
浏览文件 @
477cca3c
// !JVM_TARGET: 1.8
@JvmDefaultWithoutCompatibility
interface
A
<
T
>
{
fun
test
(
p
:
T
)
{}
}
@JvmDefaultWithoutCompatibility
class
B
:
A
<
String
>
{}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt
0 → 100644
浏览文件 @
477cca3c
// !JVM_TARGET: 1.8
<!
JVM_DEFAULT_IN_DECLARATION
!>
@JvmDefaultWithoutCompatibility
<!>
interface
A
<
T
>
{
fun
test
(
p
:
T
)
{}
}
<!
JVM_DEFAULT_IN_DECLARATION
!>
@JvmDefaultWithoutCompatibility
<!>
class
B
:
A
<
String
>
{}
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.txt
0 → 100644
浏览文件 @
477cca3c
package
@kotlin.jvm.JvmDefaultWithoutCompatibility public interface A</*0*/ T> {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open fun test(/*0*/ p: T): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmDefaultWithoutCompatibility public final class B : A<kotlin.String> {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun test(/*0*/ p: kotlin.String): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
浏览文件 @
477cca3c
...
...
@@ -562,6 +562,34 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt"
);
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
)
@TestDataPath
(
"$PROJECT_ROOT"
)
@RunWith
(
JUnit3RunnerWithInners
.
class
)
public
static
class
JvmDefaultWithoutCompatibility
extends
AbstractDiagnosticsTestWithStdLib
{
private
void
runTest
(
String
testDataFilePath
)
throws
Exception
{
KotlinTestUtils
.
runTest
(
this
::
doTest
,
this
,
testDataFilePath
);
}
public
void
testAllFilesPresentInJvmDefaultWithoutCompatibility
()
throws
Exception
{
KotlinTestUtils
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
Pattern
.
compile
(
"^(.+)\\.fir\\.kts?$"
),
true
);
}
@TestMetadata
(
"target6.kt"
)
public
void
testTarget6
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt"
);
}
@TestMetadata
(
"target8.kt"
)
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt"
);
}
@TestMetadata
(
"target8Disabled.kt"
)
public
void
testTarget8Disabled
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt"
);
}
}
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField"
)
...
...
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
浏览文件 @
477cca3c
...
...
@@ -562,6 +562,34 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt"
);
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
)
@TestDataPath
(
"$PROJECT_ROOT"
)
@RunWith
(
JUnit3RunnerWithInners
.
class
)
public
static
class
JvmDefaultWithoutCompatibility
extends
AbstractDiagnosticsTestWithStdLibUsingJavac
{
private
void
runTest
(
String
testDataFilePath
)
throws
Exception
{
KotlinTestUtils
.
runTest
(
this
::
doTest
,
this
,
testDataFilePath
);
}
public
void
testAllFilesPresentInJvmDefaultWithoutCompatibility
()
throws
Exception
{
KotlinTestUtils
.
assertAllTestsPresentByMetadataWithExcluded
(
this
.
getClass
(),
new
File
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"
),
Pattern
.
compile
(
"^(.+)\\.kt$"
),
Pattern
.
compile
(
"^(.+)\\.fir\\.kts?$"
),
true
);
}
@TestMetadata
(
"target6.kt"
)
public
void
testTarget6
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt"
);
}
@TestMetadata
(
"target8.kt"
)
public
void
testTarget8
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt"
);
}
@TestMetadata
(
"target8Disabled.kt"
)
public
void
testTarget8Disabled
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt"
);
}
}
}
@TestMetadata
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField"
)
...
...
libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt
浏览文件 @
477cca3c
...
...
@@ -32,3 +32,18 @@ import kotlin.internal.RequireKotlinVersionKind
@RequireKotlin
(
"1.2.40"
,
versionKind
=
RequireKotlinVersionKind
.
COMPILER_VERSION
)
@Target
(
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
PROPERTY
)
annotation
class
JvmDefault
/**
* Prevents the compiler from generating compatibility accessors for the annotated class or interface, and suppresses
* any related compatibility warnings. In other words, this annotation makes the compiler generate the annotated class
* or interface in the `-Xjvm-default=all` mode, where only JVM default methods are generated, without `DefaultImpls`.
*
* Annotating an existing class with this annotation is a binary incompatible change. Therefore this annotation makes
* the most sense for _new_ classes in libraries which opted into the compatibility mode.
*
* Used only with `-Xjvm-default=compatibility|all-compatibility`.
*/
@SinceKotlin
(
"1.4"
)
@RequireKotlin
(
"1.4"
,
versionKind
=
RequireKotlinVersionKind
.
COMPILER_VERSION
)
@Target
(
AnnotationTarget
.
CLASS
)
annotation
class
JvmDefaultWithoutCompatibility
libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
浏览文件 @
477cca3c
...
...
@@ -3225,6 +3225,9 @@ public final class kotlin/jvm/JvmClassMappingKt {
public abstract interface annotation class kotlin/jvm/JvmDefault : java/lang/annotation/Annotation {
}
public abstract interface annotation class kotlin/jvm/JvmDefaultWithoutCompatibility : java/lang/annotation/Annotation {
}
public abstract interface annotation class kotlin/jvm/JvmField : java/lang/annotation/Annotation {
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录