Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
f64980a5
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,发现更多精彩内容 >>
提交
f64980a5
编写于
12月 01, 2020
作者:
D
Denis.Zharkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check for bytecode target when @JvmRecord is used
^KT-43677 In Progress
上级
b860a0c6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
67 addition
and
1 deletion
+67
-1
compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
...iler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
+12
-0
compiler/testData/cli/jvm/jvmRecordOk.args
compiler/testData/cli/jvm/jvmRecordOk.args
+8
-0
compiler/testData/cli/jvm/jvmRecordOk.kt
compiler/testData/cli/jvm/jvmRecordOk.kt
+2
-0
compiler/testData/cli/jvm/jvmRecordOk.out
compiler/testData/cli/jvm/jvmRecordOk.out
+10
-0
compiler/testData/cli/jvm/jvmRecordWrongTarget.args
compiler/testData/cli/jvm/jvmRecordWrongTarget.args
+8
-0
compiler/testData/cli/jvm/jvmRecordWrongTarget.kt
compiler/testData/cli/jvm/jvmRecordWrongTarget.kt
+2
-0
compiler/testData/cli/jvm/jvmRecordWrongTarget.out
compiler/testData/cli/jvm/jvmRecordWrongTarget.out
+11
-0
compiler/testData/cli/jvm/wrongJvmTargetVersion.out
compiler/testData/cli/jvm/wrongJvmTargetVersion.out
+1
-1
compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
...ommon/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
+3
-0
compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
.../tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
+10
-0
未找到文件。
compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
浏览文件 @
f64980a5
...
@@ -67,9 +67,21 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
...
@@ -67,9 +67,21 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
}
}
}
if
(
languageVersionSettings
.
supportsFeature
(
LanguageFeature
.
JvmRecordSupport
)
&&
!
jvmTarget
.
isRecordsAllowed
())
{
messageCollector
.
report
(
ERROR
,
"-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15_PREVIEW.description} or later"
)
}
addAll
(
JVMConfigurationKeys
.
ADDITIONAL_JAVA_MODULES
,
arguments
.
additionalJavaModules
?.
asList
())
addAll
(
JVMConfigurationKeys
.
ADDITIONAL_JAVA_MODULES
,
arguments
.
additionalJavaModules
?.
asList
())
}
}
private
fun
JvmTarget
.
isRecordsAllowed
():
Boolean
{
if
(
majorVersion
<
JvmTarget
.
JVM_15_PREVIEW
.
majorVersion
)
return
false
return
isPreview
||
majorVersion
>
JvmTarget
.
JVM_15_PREVIEW
.
majorVersion
}
fun
CompilerConfiguration
.
configureJdkHome
(
arguments
:
K2JVMCompilerArguments
):
Boolean
{
fun
CompilerConfiguration
.
configureJdkHome
(
arguments
:
K2JVMCompilerArguments
):
Boolean
{
val
messageCollector
=
getNotNull
(
CLIConfigurationKeys
.
MESSAGE_COLLECTOR_KEY
)
val
messageCollector
=
getNotNull
(
CLIConfigurationKeys
.
MESSAGE_COLLECTOR_KEY
)
...
...
compiler/testData/cli/jvm/jvmRecordOk.args
0 → 100644
浏览文件 @
f64980a5
$TESTDATA_DIR$/jvmRecordWrongTarget.kt
-d
$TEMP_DIR$
-jdk-home
$JDK_15$
-XXLanguage:+JvmRecordSupport
-jvm-target
15_PREVIEW
compiler/testData/cli/jvm/jvmRecordOk.kt
0 → 100644
浏览文件 @
f64980a5
@JvmRecord
data class
MyRec
(
val
name
:
String
)
compiler/testData/cli/jvm/jvmRecordOk.out
0 → 100644
浏览文件 @
f64980a5
warning: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:+JvmRecordSupport
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
OK
compiler/testData/cli/jvm/jvmRecordWrongTarget.args
0 → 100644
浏览文件 @
f64980a5
$TESTDATA_DIR$/jvmRecordWrongTarget.kt
-d
$TEMP_DIR$
-cp
$JDK_15$
-XXLanguage:+JvmRecordSupport
-jvm-target
9
compiler/testData/cli/jvm/jvmRecordWrongTarget.kt
0 → 100644
浏览文件 @
f64980a5
@JvmRecord
data class
MyRec
(
val
name
:
String
)
compiler/testData/cli/jvm/jvmRecordWrongTarget.out
0 → 100644
浏览文件 @
f64980a5
warning: ATTENTION!
This build uses unsafe internal compiler arguments:
-XXLanguage:+JvmRecordSupport
This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
error: -XXLanguage:+JvmRecordSupport feature is only supported with JVM target 15_PREVIEW or later
COMPILATION_ERROR
compiler/testData/cli/jvm/wrongJvmTargetVersion.out
浏览文件 @
f64980a5
error: unknown JVM target version: 1.5
error: unknown JVM target version: 1.5
Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15
Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15
, 15_PREVIEW
COMPILATION_ERROR
COMPILATION_ERROR
compiler/tests-common/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
浏览文件 @
f64980a5
...
@@ -261,6 +261,9 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
...
@@ -261,6 +261,9 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
.
replace
(
.
replace
(
"$FOREIGN_ANNOTATIONS_DIR$"
,
"$FOREIGN_ANNOTATIONS_DIR$"
,
new
File
(
AbstractForeignAnnotationsTestKt
.
getFOREIGN_ANNOTATIONS_SOURCES_PATH
()).
getPath
()
new
File
(
AbstractForeignAnnotationsTestKt
.
getFOREIGN_ANNOTATIONS_SOURCES_PATH
()).
getPath
()
).
replace
(
"$JDK_15$"
,
KotlinTestUtils
.
getJdk15Home
().
getPath
()
);
);
}
}
...
...
compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java
浏览文件 @
f64980a5
...
@@ -530,6 +530,16 @@ public class CliTestGenerated extends AbstractCliTest {
...
@@ -530,6 +530,16 @@ public class CliTestGenerated extends AbstractCliTest {
runTest
(
"compiler/testData/cli/jvm/jvmDefaultAll.args"
);
runTest
(
"compiler/testData/cli/jvm/jvmDefaultAll.args"
);
}
}
@TestMetadata
(
"jvmRecordOk.args"
)
public
void
testJvmRecordOk
()
throws
Exception
{
runTest
(
"compiler/testData/cli/jvm/jvmRecordOk.args"
);
}
@TestMetadata
(
"jvmRecordWrongTarget.args"
)
public
void
testJvmRecordWrongTarget
()
throws
Exception
{
runTest
(
"compiler/testData/cli/jvm/jvmRecordWrongTarget.args"
);
}
@TestMetadata
(
"kotlinHomeWithoutStdlib.args"
)
@TestMetadata
(
"kotlinHomeWithoutStdlib.args"
)
public
void
testKotlinHomeWithoutStdlib
()
throws
Exception
{
public
void
testKotlinHomeWithoutStdlib
()
throws
Exception
{
runTest
(
"compiler/testData/cli/jvm/kotlinHomeWithoutStdlib.args"
);
runTest
(
"compiler/testData/cli/jvm/kotlinHomeWithoutStdlib.args"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录