Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
d4de2c4d
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,发现更多精彩内容 >>
提交
d4de2c4d
编写于
11月 25, 2020
作者:
D
Denis.Zharkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check that we have JDK 15 in classpath when using @JvmRecord
^KT-43677 In Progress
上级
85962d83
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
42 addition
and
0 deletion
+42
-0
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
...fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
+5
-0
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt
...lin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt
+7
-0
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
...tlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
+1
-0
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
...g/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
+1
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt
.../testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt
+9
-0
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt
...tics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt
+9
-0
compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
...s/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
+5
-0
compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
...s/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
+5
-0
未找到文件。
compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestWithStdlibGenerated.java
浏览文件 @
d4de2c4d
...
...
@@ -201,6 +201,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"
);
}
@TestMetadata
(
"jvmRecordWithoutJdk15.kt"
)
public
void
testJvmRecordWithoutJdk15
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"
);
}
@TestMetadata
(
"JvmSyntheticOnDelegate.kt"
)
public
void
testJvmSyntheticOnDelegate
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"
);
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmRecordApplicabilityChecker.kt
浏览文件 @
d4de2c4d
...
...
@@ -10,12 +10,14 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import
org.jetbrains.kotlin.descriptors.ClassKind
import
org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import
org.jetbrains.kotlin.diagnostics.Errors
import
org.jetbrains.kotlin.incremental.components.NoLookupLocation
import
org.jetbrains.kotlin.psi.KtClassOrObject
import
org.jetbrains.kotlin.psi.KtDeclaration
import
org.jetbrains.kotlin.resolve.DescriptorUtils
import
org.jetbrains.kotlin.resolve.checkers.DeclarationChecker
import
org.jetbrains.kotlin.resolve.checkers.DeclarationCheckerContext
import
org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import
org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass
import
org.jetbrains.kotlin.resolve.jvm.JAVA_LANG_RECORD_FQ_NAME
import
org.jetbrains.kotlin.resolve.jvm.annotations.JVM_RECORD_ANNOTATION_FQ_NAME
import
org.jetbrains.kotlin.resolve.jvm.annotations.isJvmRecord
...
...
@@ -29,6 +31,11 @@ object JvmRecordApplicabilityChecker : DeclarationChecker {
declaration
.
annotationEntries
.
firstOrNull
{
it
.
shortName
==
JVM_RECORD_ANNOTATION_FQ_NAME
.
shortName
()
}
?:
declaration
if
(
context
.
moduleDescriptor
.
resolveTopLevelClass
(
JAVA_LANG_RECORD_FQ_NAME
,
NoLookupLocation
.
FOR_DEFAULT_IMPORTS
)
==
null
)
{
context
.
trace
.
report
(
ErrorsJvm
.
JVM_RECORD_REQUIRES_JDK15
.
on
(
reportOn
))
return
}
if
(!
context
.
languageVersionSettings
.
supportsFeature
(
LanguageFeature
.
JvmRecordSupport
))
{
context
.
trace
.
report
(
Errors
.
UNSUPPORTED_FEATURE
.
on
(
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java
浏览文件 @
d4de2c4d
...
...
@@ -157,6 +157,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP
.
put
(
JVM_RECORD_NOT_VAL_PARAMETER
,
"Constructor parameter of @JvmRecord class should be a val"
);
MAP
.
put
(
JVM_RECORD_NOT_LAST_VARARG_PARAMETER
,
"Only the last constructor parameter of @JvmRecord may be a vararg"
);
MAP
.
put
(
JVM_RECORD_EXTENDS_CLASS
,
"Record cannot inherit an other class but java.lang.Record"
,
RENDER_TYPE
);
MAP
.
put
(
JVM_RECORD_REQUIRES_JDK15
,
"Using @JvmRecords requires at least JDK 15"
);
String
MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS
=
"Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. "
+
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java
浏览文件 @
d4de2c4d
...
...
@@ -120,6 +120,7 @@ public interface ErrorsJvm {
DiagnosticFactory0
<
PsiElement
>
JVM_RECORD_NOT_VAL_PARAMETER
=
DiagnosticFactory0
.
create
(
ERROR
);
DiagnosticFactory0
<
PsiElement
>
JVM_RECORD_NOT_LAST_VARARG_PARAMETER
=
DiagnosticFactory0
.
create
(
ERROR
);
DiagnosticFactory1
<
PsiElement
,
KotlinType
>
JVM_RECORD_EXTENDS_CLASS
=
DiagnosticFactory1
.
create
(
ERROR
);
DiagnosticFactory0
<
PsiElement
>
JVM_RECORD_REQUIRES_JDK15
=
DiagnosticFactory0
.
create
(
ERROR
);
DiagnosticFactory0
<
KtDeclaration
>
NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT
=
DiagnosticFactory0
.
create
(
WARNING
,
DECLARATION_SIGNATURE
);
...
...
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.fir.kt
0 → 100644
浏览文件 @
d4de2c4d
// !LANGUAGE: +JvmRecordSupport
// SKIP_TXT
@JvmRecord
class
MyRec
(
val
x
:
String
,
val
y
:
Int
,
vararg
val
z
:
Double
,
)
compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt
0 → 100644
浏览文件 @
d4de2c4d
// !LANGUAGE: +JvmRecordSupport
// SKIP_TXT
<!
JVM_RECORD_REQUIRES_JDK15
!>
@JvmRecord
<!>
class
MyRec
(
val
x
:
String
,
val
y
:
Int
,
vararg
val
z
:
Double
,
)
compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java
浏览文件 @
d4de2c4d
...
...
@@ -201,6 +201,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"
);
}
@TestMetadata
(
"jvmRecordWithoutJdk15.kt"
)
public
void
testJvmRecordWithoutJdk15
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"
);
}
@TestMetadata
(
"JvmSyntheticOnDelegate.kt"
)
public
void
testJvmSyntheticOnDelegate
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"
);
...
...
compiler/tests-gen/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
浏览文件 @
d4de2c4d
...
...
@@ -201,6 +201,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/explicitMetadata.kt"
);
}
@TestMetadata
(
"jvmRecordWithoutJdk15.kt"
)
public
void
testJvmRecordWithoutJdk15
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/jvmRecordWithoutJdk15.kt"
);
}
@TestMetadata
(
"JvmSyntheticOnDelegate.kt"
)
public
void
testJvmSyntheticOnDelegate
()
throws
Exception
{
runTest
(
"compiler/testData/diagnostics/testsWithStdLib/annotations/JvmSyntheticOnDelegate.kt"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录