Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
17c90665
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,发现更多精彩内容 >>
提交
17c90665
编写于
10月 13, 2015
作者:
D
Denis Zharkov
提交者:
Mikhail Glukhikh
10月 14, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Transform Throwable members to properties
上级
9088bf67
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
63 addition
and
51 deletion
+63
-51
compiler/testData/builtin-classes.txt
compiler/testData/builtin-classes.txt
+4
-2
compiler/testData/codegen/box/builtinsProperties/throwable.kt
...iler/testData/codegen/box/builtinsProperties/throwable.kt
+10
-0
compiler/testData/codegen/box/classes/exceptionConstructor.kt
...iler/testData/codegen/box/classes/exceptionConstructor.kt
+1
-1
compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt
...olStructures/tryCatchInExpressions/multipleCatchBlocks.kt
+1
-1
compiler/testData/codegen/controlStructures/tryCatch.kt
compiler/testData/codegen/controlStructures/tryCatch.kt
+1
-1
compiler/testData/compileJavaAgainstKotlin/method/throws/ClassMembers.txt
...a/compileJavaAgainstKotlin/method/throws/ClassMembers.txt
+4
-4
compiler/testData/compileJavaAgainstKotlin/method/throws/Constructor.txt
...ta/compileJavaAgainstKotlin/method/throws/Constructor.txt
+4
-4
compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.txt
...ta/compileJavaAgainstKotlin/method/throws/DefaultArgs.txt
+2
-2
compiler/testData/compileJavaAgainstKotlin/method/throws/Delegation.txt
...ata/compileJavaAgainstKotlin/method/throws/Delegation.txt
+4
-4
compiler/testData/compileJavaAgainstKotlin/method/throws/GenericSubstitution.txt
...leJavaAgainstKotlin/method/throws/GenericSubstitution.txt
+2
-2
compiler/testData/compileJavaAgainstKotlin/method/throws/TopLevel.txt
...tData/compileJavaAgainstKotlin/method/throws/TopLevel.txt
+4
-4
compiler/testData/compileJavaAgainstKotlin/method/throws/TraitMembers.txt
...a/compileJavaAgainstKotlin/method/throws/TraitMembers.txt
+4
-4
compiler/testData/diagnostics/tests/ResolveToJava.kt
compiler/testData/diagnostics/tests/ResolveToJava.kt
+1
-1
compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt
...er/testData/diagnostics/tests/regressions/DoubleDefine.kt
+1
-1
compiler/testData/diagnostics/tests/regressions/kt498.txt
compiler/testData/diagnostics/tests/regressions/kt498.txt
+2
-2
compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java
...otlin/codegen/generated/BlackBoxCodegenTestGenerated.java
+6
-0
core/builtins/native/kotlin/Throwable.kt
core/builtins/native/kotlin/Throwable.kt
+1
-11
idea/testData/checker/ResolveToJava.kt
idea/testData/checker/ResolveToJava.kt
+1
-1
idea/testData/checker/regression/DoubleDefine.kt
idea/testData/checker/regression/DoubleDefine.kt
+1
-1
js/js.translator/testData/regression/cases/kt2470.kt
js/js.translator/testData/regression/cases/kt2470.kt
+1
-3
js/js.translator/testData/standardClasses/cases/arrayFactoryMethods.kt
...tor/testData/standardClasses/cases/arrayFactoryMethods.kt
+2
-2
libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt
...aries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt
+6
-0
未找到文件。
compiler/testData/builtin-classes.txt
浏览文件 @
17c90665
...
...
@@ -1274,8 +1274,10 @@ public final class String : kotlin.Comparable<kotlin.String>, kotlin.CharSequenc
public open class Throwable {
/*primary*/ public constructor Throwable(/*0*/ message: kotlin.String? = ..., /*1*/ cause: kotlin.Throwable? = ...)
public final fun getCause(): kotlin.Throwable?
public final fun getMessage(): kotlin.String?
public final val cause: kotlin.Throwable?
public final fun <get-cause>(): kotlin.Throwable?
public final val message: kotlin.String?
public final fun <get-message>(): kotlin.String?
public final fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/codegen/box/builtinsProperties/throwable.kt
0 → 100644
浏览文件 @
17c90665
fun
box
():
String
{
try
{
throw
Throwable
(
"OK"
,
null
)
}
catch
(
t
:
Throwable
)
{
if
(
t
.
cause
!=
null
)
return
"fail 1"
return
t
.
message
!!
}
return
"fail 2"
}
compiler/testData/codegen/box/classes/exceptionConstructor.kt
浏览文件 @
17c90665
...
...
@@ -3,5 +3,5 @@ class GameError(msg: String): Exception(msg) {
fun
box
():
String
{
val
e
=
GameError
(
"foo"
)
return
if
(
e
.
getMessage
()
==
"foo"
)
"OK"
else
"fail"
return
if
(
e
.
message
==
"foo"
)
"OK"
else
"fail"
}
compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt
浏览文件 @
17c90665
...
...
@@ -13,7 +13,7 @@ fun box(): String =
"e2"
}
catch
(
e3
:
Exception3
)
{
e3
.
getMessage
()
e3
.
message
}
catch
(
e
:
Exception
)
{
"e"
...
...
compiler/testData/codegen/controlStructures/tryCatch.kt
浏览文件 @
17c90665
...
...
@@ -4,6 +4,6 @@ fun foo(s: String): String? {
return
"no message"
;
}
catch
(
e
:
NumberFormatException
)
{
return
e
.
getMessage
();
// Work around an overload-resolution bug
return
e
.
message
// Work around an overload-resolution bug
}
}
compiler/testData/compileJavaAgainstKotlin/method/throws/ClassMembers.txt
浏览文件 @
17c90665
...
...
@@ -2,15 +2,15 @@ package test
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
public final class E2 : java.lang.Exception {
public constructor E2()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/Constructor.txt
浏览文件 @
17c90665
...
...
@@ -2,15 +2,15 @@ package test
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
public final class E2 : java.lang.Exception {
public constructor E2()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/DefaultArgs.txt
浏览文件 @
17c90665
...
...
@@ -4,8 +4,8 @@ package test
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/Delegation.txt
浏览文件 @
17c90665
...
...
@@ -2,15 +2,15 @@ package test
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
public final class E2 : java.lang.Exception {
public constructor E2()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/GenericSubstitution.txt
浏览文件 @
17c90665
...
...
@@ -11,8 +11,8 @@ public final class Derived : test.Base<kotlin.String> {
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/TopLevel.txt
浏览文件 @
17c90665
...
...
@@ -6,15 +6,15 @@ public fun two(): kotlin.Unit
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
public final class E2 : java.lang.Exception {
public constructor E2()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/compileJavaAgainstKotlin/method/throws/TraitMembers.txt
浏览文件 @
17c90665
...
...
@@ -2,15 +2,15 @@ package test
public final class E1 : java.lang.Exception {
public constructor E1()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
public final class E2 : java.lang.Exception {
public constructor E2()
public final /*fake_override*/
fun getCause()
: kotlin.Throwable?
public final /*fake_override*/
fun getMessage()
: kotlin.String?
public final /*fake_override*/
val cause
: kotlin.Throwable?
public final /*fake_override*/
val message
: kotlin.String?
public final /*fake_override*/ fun printStackTrace(): kotlin.Unit
}
...
...
compiler/testData/diagnostics/tests/ResolveToJava.kt
浏览文件 @
17c90665
...
...
@@ -36,7 +36,7 @@ fun test(<!UNUSED_PARAMETER!>l<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.util
// ...
}
catch
(
e
:
Exception
)
{
System
.
out
.
println
(
e
.
getMessage
()
)
System
.
out
.
println
(
e
.
message
)
}
PrintStream
(
"sdf"
)
...
...
compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt
浏览文件 @
17c90665
...
...
@@ -60,6 +60,6 @@ fun main(args: Array<String>) {
System
.
out
.
println
(
"You won!"
);
}
catch
(
e
:
Throwable
)
{
System
.
out
.
println
(
e
.
getMessage
()
)
System
.
out
.
println
(
e
.
message
)
}
}
compiler/testData/diagnostics/tests/regressions/kt498.txt
浏览文件 @
17c90665
...
...
@@ -4,9 +4,9 @@ public fun </*0*/ T : kotlin.Any> T.getJavaClass(): java.lang.Class<T>
public final class IdUnavailableException : java.lang.Exception {
public constructor IdUnavailableException()
public final override /*1*/ /*fake_override*/ val cause: kotlin.Throwable?
public final override /*1*/ /*fake_override*/ val message: kotlin.String?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun getCause(): kotlin.Throwable?
public final override /*1*/ /*fake_override*/ fun getMessage(): kotlin.String?
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun printStackTrace(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
...
...
compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java
浏览文件 @
17c90665
...
...
@@ -921,6 +921,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"compiler/testData/codegen/box/builtinsProperties/maps.kt"
);
doTest
(
fileName
);
}
@TestMetadata
(
"throwable.kt"
)
public
void
testThrowable
()
throws
Exception
{
String
fileName
=
JetTestUtils
.
navigationMetadata
(
"compiler/testData/codegen/box/builtinsProperties/throwable.kt"
);
doTest
(
fileName
);
}
}
@TestMetadata
(
"compiler/testData/codegen/box/casts"
)
...
...
core/builtins/native/kotlin/Throwable.kt
浏览文件 @
17c90665
...
...
@@ -22,17 +22,7 @@ package kotlin
* @param message the detail message string.
* @param cause the cause of this throwable.
*/
public
open
class
Throwable
(
message
:
String
?
=
null
,
cause
:
Throwable
?
=
null
)
{
/**
* Returns the detail message of this throwable.
*/
public
fun
getMessage
():
String
?
/**
* Returns the cause of this throwable.
*/
public
fun
getCause
():
Throwable
?
public
open
class
Throwable
(
val
message
:
String
?
=
null
,
val
cause
:
Throwable
?
=
null
)
{
/**
* Prints the stack trace of this throwable to the standard output.
*/
...
...
idea/testData/checker/ResolveToJava.kt
浏览文件 @
17c90665
...
...
@@ -35,7 +35,7 @@ fun test(<warning>l</warning> : List<Int>) {
// ...
}
catch
(
e
:
Exception
)
{
System
.
out
.
println
(
e
.
getMessage
()
)
System
.
out
.
println
(
e
.
message
)
}
PrintStream
(
"sdf"
)
...
...
idea/testData/checker/regression/DoubleDefine.kt
浏览文件 @
17c90665
...
...
@@ -60,6 +60,6 @@ fun main(args: Array<String>) {
System
.
out
.
println
(
"You won!"
);
}
catch
(
e
:
Throwable
)
{
System
.
out
.
println
(
e
.
getMessage
()
)
System
.
out
.
println
(
e
.
message
)
}
}
js/js.translator/testData/regression/cases/kt2470.kt
浏览文件 @
17c90665
...
...
@@ -2,8 +2,6 @@
package
foo
@
native
val
Exception
.
message
:
String
get
()
=
noImpl
public
fun
<
T
:
Throwable
>
failsWith
(
block
:
()
->
Any
):
T
{
try
{
block
()
...
...
@@ -20,5 +18,5 @@ fun box(): String {
throw
Exception
(
"OK"
)
}
return
a
.
message
return
a
.
message
!!
}
js/js.translator/testData/standardClasses/cases/arrayFactoryMethods.kt
浏览文件 @
17c90665
package
foo
class
Fail
(
val
message
:
String
)
:
Exception
(
message
)
class
Fail
(
message
:
String
)
:
Exception
(
message
)
fun
test
(
testName
:
String
,
actual
:
Any
,
expectedAsString
:
String
)
{
val
expected
=
eval
(
"[$expectedAsString]"
)
...
...
@@ -20,7 +20,7 @@ fun box(): String {
test
(
"doubleArrayOf"
,
doubleArrayOf
(
0.0
,
1.1
,
2.2
,
3.3
,
4.4
),
"0.0, 1.1, 2.2, 3.3, 4.4"
)
}
catch
(
e
:
Fail
)
{
return
e
.
message
return
e
.
message
!!
}
return
"OK"
...
...
libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt
浏览文件 @
17c90665
...
...
@@ -78,3 +78,9 @@ public inline fun <K, V> Map<K, V>.values(): Collection<V> = values
@
kotlin
.
jvm
.
JvmName
(
"mutableValues"
)
@Deprecated
(
"Use property 'values' instead"
,
ReplaceWith
(
"this.values"
))
public
inline
fun
<
K
,
V
>
MutableMap
<
K
,
V
>.
values
():
MutableCollection
<
V
>
=
values
@Deprecated
(
"Use property 'message' instead"
,
ReplaceWith
(
"this.message"
))
public
inline
fun
Throwable
.
getMessage
():
String
?
=
message
@Deprecated
(
"Use property 'cause' instead"
,
ReplaceWith
(
"this.cause"
))
public
inline
fun
Throwable
.
getCause
():
Throwable
?
=
cause
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录