Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
3b18531b
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,发现更多精彩内容 >>
提交
3b18531b
编写于
12月 07, 2016
作者:
A
Alexander Udalov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add expectedVersion to IncompatibleVersionErrorData, move to deserialization
上级
c811c1be
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
20 deletion
+25
-20
compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt
...etbrains/kotlin/codegen/state/IncompatibleClassTracker.kt
+9
-3
compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt
.../kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt
+8
-11
compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/TraceBasedErrorReporter.kt
...ns/kotlin/load/java/components/TraceBasedErrorReporter.kt
+4
-2
core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/IncompatibleVersionErrorData.kt
...alization/deserialization/IncompatibleVersionErrorData.kt
+4
-4
未找到文件。
compiler/backend/src/org/jetbrains/kotlin/codegen/state/IncompatibleClassTracker.kt
浏览文件 @
3b18531b
...
...
@@ -16,9 +16,10 @@
package
org.jetbrains.kotlin.codegen.state
import
org.jetbrains.kotlin.load.java.
components.IncompatibleVersionErrorData
import
org.jetbrains.kotlin.load.java.
JvmBytecodeBinaryVersion
import
org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
import
org.jetbrains.kotlin.resolve.BindingTrace
import
org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
import
org.jetbrains.kotlin.util.slicedMap.Slices
import
org.jetbrains.kotlin.util.slicedMap.WritableSlice
...
...
@@ -36,13 +37,18 @@ class IncompatibleClassTrackerImpl(val trace: BindingTrace) : IncompatibleClassT
override
fun
record
(
binaryClass
:
KotlinJvmBinaryClass
)
{
if
(
classes
.
add
(
binaryClass
.
location
))
{
val
errorData
=
IncompatibleVersionErrorData
(
binaryClass
.
classHeader
.
bytecodeVersion
,
binaryClass
.
location
,
binaryClass
.
classId
)
val
errorData
=
IncompatibleVersionErrorData
(
binaryClass
.
classHeader
.
bytecodeVersion
,
JvmBytecodeBinaryVersion
.
INSTANCE
,
binaryClass
.
location
,
binaryClass
.
classId
)
trace
.
record
(
BYTECODE_VERSION_ERRORS
,
binaryClass
.
location
,
errorData
)
}
}
companion
object
{
@JvmField
val
BYTECODE_VERSION_ERRORS
:
WritableSlice
<
String
,
IncompatibleVersionErrorData
>
=
Slices
.
createCollectiveSlice
()
val
BYTECODE_VERSION_ERRORS
:
WritableSlice
<
String
,
IncompatibleVersionErrorData
<
JvmBytecodeBinaryVersion
>
>
=
Slices
.
createCollectiveSlice
()
}
}
compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt
浏览文件 @
3b18531b
...
...
@@ -27,8 +27,6 @@ import org.jetbrains.kotlin.codegen.state.IncompatibleClassTrackerImpl
import
org.jetbrains.kotlin.diagnostics.*
import
org.jetbrains.kotlin.diagnostics.DiagnosticUtils.sortedDiagnostics
import
org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
import
org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import
org.jetbrains.kotlin.load.java.components.IncompatibleVersionErrorData
import
org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter
import
org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import
org.jetbrains.kotlin.psi.KtFile
...
...
@@ -39,7 +37,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
import
org.jetbrains.kotlin.resolve.diagnostics.Diagnostics
import
org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices
import
org.jetbrains.kotlin.resolve.jvm.JvmClassName
import
org.jetbrains.kotlin.serialization.deserialization.
BinaryVersion
import
org.jetbrains.kotlin.serialization.deserialization.
IncompatibleVersionErrorData
import
java.util.*
class
AnalyzerWithCompilerReport
(
private
val
messageCollector
:
MessageCollector
)
{
...
...
@@ -84,12 +82,12 @@ class AnalyzerWithCompilerReport(private val messageCollector: MessageCollector)
}
}
private
val
abiVersionErrors
:
List
<
IncompatibleVersionErrorData
>
private
val
abiVersionErrors
:
List
<
IncompatibleVersionErrorData
<
JvmMetadataVersion
>
>
get
()
{
val
bindingContext
=
analysisResult
.
bindingContext
val
errorClasses
=
bindingContext
.
getKeys
(
TraceBasedErrorReporter
.
METADATA_VERSION_ERRORS
)
val
result
=
ArrayList
<
IncompatibleVersionErrorData
>(
errorClasses
.
size
)
val
result
=
ArrayList
<
IncompatibleVersionErrorData
<
JvmMetadataVersion
>
>(
errorClasses
.
size
)
for
(
kotlinClass
in
errorClasses
)
{
result
.
add
(
bindingContext
.
get
(
TraceBasedErrorReporter
.
METADATA_VERSION_ERRORS
,
kotlinClass
)
!!
)
}
...
...
@@ -97,9 +95,9 @@ class AnalyzerWithCompilerReport(private val messageCollector: MessageCollector)
return
result
}
private
fun
reportMetadataVersionErrors
(
errors
:
List
<
IncompatibleVersionErrorData
>)
{
private
fun
reportMetadataVersionErrors
(
errors
:
List
<
IncompatibleVersionErrorData
<
JvmMetadataVersion
>
>)
{
for
(
data
in
errors
)
{
reportIncompatibleBinaryVersion
(
messageCollector
,
data
,
JvmMetadataVersion
.
INSTANCE
,
"metadata"
,
CompilerMessageSeverity
.
ERROR
)
reportIncompatibleBinaryVersion
(
messageCollector
,
data
,
"metadata"
,
CompilerMessageSeverity
.
ERROR
)
}
}
...
...
@@ -245,21 +243,20 @@ class AnalyzerWithCompilerReport(private val messageCollector: MessageCollector)
for
(
location
in
locations
)
{
val
data
=
bindingContext
.
get
(
IncompatibleClassTrackerImpl
.
BYTECODE_VERSION_ERRORS
,
location
)
?:
error
(
"Value is missing for key in binding context: "
+
location
)
reportIncompatibleBinaryVersion
(
messageCollector
,
data
,
JvmBytecodeBinaryVersion
.
INSTANCE
,
"bytecode"
,
severity
)
reportIncompatibleBinaryVersion
(
messageCollector
,
data
,
"bytecode"
,
severity
)
}
}
private
fun
reportIncompatibleBinaryVersion
(
messageCollector
:
MessageCollector
,
data
:
IncompatibleVersionErrorData
,
expectedVersion
:
BinaryVersion
,
data
:
IncompatibleVersionErrorData
<
*
>,
versionSortText
:
String
,
severity
:
CompilerMessageSeverity
)
{
messageCollector
.
report
(
severity
,
"Class '"
+
JvmClassName
.
byClassId
(
data
.
classId
)
+
"' was compiled with an incompatible version of Kotlin. "
+
"The binary version of its "
+
versionSortText
+
" is "
+
data
.
actualVersion
+
", "
+
"expected version is "
+
expectedVersion
,
"expected version is "
+
data
.
expectedVersion
,
CompilerMessageLocation
.
create
(
toSystemDependentName
(
data
.
filePath
),
-
1
,
-
1
,
null
)
)
}
...
...
compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/TraceBasedErrorReporter.kt
浏览文件 @
3b18531b
...
...
@@ -18,11 +18,13 @@ package org.jetbrains.kotlin.load.java.components
import
org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import
org.jetbrains.kotlin.descriptors.ClassDescriptor
import
org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import
org.jetbrains.kotlin.name.ClassId
import
org.jetbrains.kotlin.resolve.BindingTrace
import
org.jetbrains.kotlin.resolve.OverrideResolver
import
org.jetbrains.kotlin.serialization.deserialization.BinaryVersion
import
org.jetbrains.kotlin.serialization.deserialization.ErrorReporter
import
org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
import
org.jetbrains.kotlin.util.slicedMap.BasicWritableSlice
import
org.jetbrains.kotlin.util.slicedMap.Slices
import
org.jetbrains.kotlin.util.slicedMap.WritableSlice
...
...
@@ -30,7 +32,7 @@ import org.jetbrains.kotlin.util.slicedMap.WritableSlice
class
TraceBasedErrorReporter
(
private
val
trace
:
BindingTrace
)
:
ErrorReporter
{
companion
object
{
@JvmField
val
METADATA_VERSION_ERRORS
:
WritableSlice
<
String
,
IncompatibleVersionErrorData
>
=
Slices
.
createCollectiveSlice
()
val
METADATA_VERSION_ERRORS
:
WritableSlice
<
String
,
IncompatibleVersionErrorData
<
JvmMetadataVersion
>
>
=
Slices
.
createCollectiveSlice
()
@JvmField
val
INCOMPLETE_HIERARCHY
:
WritableSlice
<
ClassDescriptor
,
List
<
String
>>
=
Slices
.
createCollectiveSlice
()
...
...
@@ -41,7 +43,7 @@ class TraceBasedErrorReporter(private val trace: BindingTrace) : ErrorReporter {
}
override
fun
reportIncompatibleMetadataVersion
(
classId
:
ClassId
,
filePath
:
String
,
actualVersion
:
BinaryVersion
)
{
trace
.
record
(
METADATA_VERSION_ERRORS
,
filePath
,
IncompatibleVersionErrorData
(
actualVersion
,
filePath
,
classId
))
trace
.
record
(
METADATA_VERSION_ERRORS
,
filePath
,
IncompatibleVersionErrorData
(
actualVersion
as
JvmMetadataVersion
,
JvmMetadataVersion
.
INSTANCE
,
filePath
,
classId
))
}
override
fun
reportIncompleteHierarchy
(
descriptor
:
ClassDescriptor
,
unresolvedSuperClasses
:
List
<
String
>)
{
...
...
co
mpiler/frontend.java/src/org/jetbrains/kotlin/load/java/components
/IncompatibleVersionErrorData.kt
→
co
re/deserialization/src/org/jetbrains/kotlin/serialization/deserialization
/IncompatibleVersionErrorData.kt
浏览文件 @
3b18531b
...
...
@@ -14,13 +14,13 @@
* limitations under the License.
*/
package
org.jetbrains.kotlin.
load.java.components
package
org.jetbrains.kotlin.
serialization.deserialization
import
org.jetbrains.kotlin.name.ClassId
import
org.jetbrains.kotlin.serialization.deserialization.BinaryVersion
data class
IncompatibleVersionErrorData
(
val
actualVersion
:
BinaryVersion
,
data class
IncompatibleVersionErrorData
<
out
T
:
BinaryVersion
>(
val
actualVersion
:
T
,
val
expectedVersion
:
T
,
val
filePath
:
String
,
val
classId
:
ClassId
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录