Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
ff1bf673
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,发现更多精彩内容 >>
提交
ff1bf673
编写于
10月 09, 2015
作者:
D
Dmitry Petrov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Java 8 override restrictions: interface can't implement a method of 'Any'
- update Range and related classes
上级
7e9e427d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
2 deletion
+20
-2
core/builtins/src/kotlin/Range.kt
core/builtins/src/kotlin/Range.kt
+0
-2
core/builtins/src/kotlin/Ranges.kt
core/builtins/src/kotlin/Ranges.kt
+14
-0
generators/src/org/jetbrains/kotlin/generators/builtins/ranges.kt
...rs/src/org/jetbrains/kotlin/generators/builtins/ranges.kt
+4
-0
libraries/stdlib/src/kotlin/util/Ranges.kt
libraries/stdlib/src/kotlin/util/Ranges.kt
+2
-0
未找到文件。
core/builtins/src/kotlin/Range.kt
浏览文件 @
ff1bf673
...
@@ -40,6 +40,4 @@ public interface Range<T : Comparable<T>> {
...
@@ -40,6 +40,4 @@ public interface Range<T : Comparable<T>> {
* Checks if the range is empty.
* Checks if the range is empty.
*/
*/
public
fun
isEmpty
():
Boolean
=
start
>
end
public
fun
isEmpty
():
Boolean
=
start
>
end
override
fun
toString
():
String
=
"$start..$end"
}
}
core/builtins/src/kotlin/Ranges.kt
浏览文件 @
ff1bf673
...
@@ -38,6 +38,8 @@ public class ByteRange(override val start: Byte, override val end: Byte) : Range
...
@@ -38,6 +38,8 @@ public class ByteRange(override val start: Byte, override val end: Byte) : Range
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Byte. */
/** An empty range of values of type Byte. */
public
val
EMPTY
:
ByteRange
=
ByteRange
(
1
,
0
)
public
val
EMPTY
:
ByteRange
=
ByteRange
(
1
,
0
)
...
@@ -64,6 +66,8 @@ public class CharRange(override val start: Char, override val end: Char) : Range
...
@@ -64,6 +66,8 @@ public class CharRange(override val start: Char, override val end: Char) : Range
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Char. */
/** An empty range of values of type Char. */
public
val
EMPTY
:
CharRange
=
CharRange
(
1
.
toChar
(),
0
.
toChar
())
public
val
EMPTY
:
CharRange
=
CharRange
(
1
.
toChar
(),
0
.
toChar
())
...
@@ -90,6 +94,8 @@ public class ShortRange(override val start: Short, override val end: Short) : Ra
...
@@ -90,6 +94,8 @@ public class ShortRange(override val start: Short, override val end: Short) : Ra
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
if
(
isEmpty
())
-
1
else
(
31
*
start
.
toInt
()
+
end
.
toInt
())
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Short. */
/** An empty range of values of type Short. */
public
val
EMPTY
:
ShortRange
=
ShortRange
(
1
,
0
)
public
val
EMPTY
:
ShortRange
=
ShortRange
(
1
,
0
)
...
@@ -116,6 +122,8 @@ public class IntRange(override val start: Int, override val end: Int) : Range<In
...
@@ -116,6 +122,8 @@ public class IntRange(override val start: Int, override val end: Int) : Range<In
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
start
+
end
)
if
(
isEmpty
())
-
1
else
(
31
*
start
+
end
)
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Int. */
/** An empty range of values of type Int. */
public
val
EMPTY
:
IntRange
=
IntRange
(
1
,
0
)
public
val
EMPTY
:
IntRange
=
IntRange
(
1
,
0
)
...
@@ -142,6 +150,8 @@ public class LongRange(override val start: Long, override val end: Long) : Range
...
@@ -142,6 +150,8 @@ public class LongRange(override val start: Long, override val end: Long) : Range
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
(
start
xor
(
start
ushr
32
))
+
(
end
xor
(
end
ushr
32
))).
toInt
()
if
(
isEmpty
())
-
1
else
(
31
*
(
start
xor
(
start
ushr
32
))
+
(
end
xor
(
end
ushr
32
))).
toInt
()
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Long. */
/** An empty range of values of type Long. */
public
val
EMPTY
:
LongRange
=
LongRange
(
1
,
0
)
public
val
EMPTY
:
LongRange
=
LongRange
(
1
,
0
)
...
@@ -168,6 +178,8 @@ public class FloatRange(override val start: Float, override val end: Float) : Ra
...
@@ -168,6 +178,8 @@ public class FloatRange(override val start: Float, override val end: Float) : Ra
override
fun
hashCode
():
Int
=
override
fun
hashCode
():
Int
=
if
(
isEmpty
())
-
1
else
(
31
*
java
.
lang
.
Float
.
floatToIntBits
(
start
)
+
java
.
lang
.
Float
.
floatToIntBits
(
end
))
if
(
isEmpty
())
-
1
else
(
31
*
java
.
lang
.
Float
.
floatToIntBits
(
start
)
+
java
.
lang
.
Float
.
floatToIntBits
(
end
))
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Float. */
/** An empty range of values of type Float. */
public
val
EMPTY
:
FloatRange
=
FloatRange
(
1.0f
,
0.0f
)
public
val
EMPTY
:
FloatRange
=
FloatRange
(
1.0f
,
0.0f
)
...
@@ -199,6 +211,8 @@ public class DoubleRange(override val start: Double, override val end: Double) :
...
@@ -199,6 +211,8 @@ public class DoubleRange(override val start: Double, override val end: Double) :
return
(
31
*
result
+
(
temp
xor
(
temp
ushr
32
))).
toInt
()
return
(
31
*
result
+
(
temp
xor
(
temp
ushr
32
))).
toInt
()
}
}
override
fun
toString
():
String
=
"$start..$end"
companion
object
{
companion
object
{
/** An empty range of values of type Double. */
/** An empty range of values of type Double. */
public
val
EMPTY
:
DoubleRange
=
DoubleRange
(
1.0
,
0.0
)
public
val
EMPTY
:
DoubleRange
=
DoubleRange
(
1.0
,
0.0
)
...
...
generators/src/org/jetbrains/kotlin/generators/builtins/ranges.kt
浏览文件 @
ff1bf673
...
@@ -62,6 +62,8 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
...
@@ -62,6 +62,8 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
" }"
" }"
}
}
val
toString
=
"\"\$start..\$end\""
out
.
println
(
out
.
println
(
"""/**
"""/**
* A range of values of type `$t`.
* A range of values of type `$t`.
...
@@ -82,6 +84,8 @@ public class $range(override val start: $t, override val end: $t) : Range<$t>, P
...
@@ -82,6 +84,8 @@ public class $range(override val start: $t, override val end: $t) : Range<$t>, P
override fun hashCode(): Int $hashCode
override fun hashCode(): Int $hashCode
override fun toString(): String = $toString
companion object {
companion object {
/** An empty range of values of type $t. */
/** An empty range of values of type $t. */
public val EMPTY: $range = $range($emptyBounds)
public val EMPTY: $range = $range($emptyBounds)
...
...
libraries/stdlib/src/kotlin/util/Ranges.kt
浏览文件 @
ff1bf673
...
@@ -21,6 +21,8 @@ public class ComparableRange<T: Comparable<T>> (
...
@@ -21,6 +21,8 @@ public class ComparableRange<T: Comparable<T>> (
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
return
if
(
isEmpty
())
-
1
else
31
*
start
.
hashCode
()
+
end
.
hashCode
()
return
if
(
isEmpty
())
-
1
else
31
*
start
.
hashCode
()
+
end
.
hashCode
()
}
}
override
fun
toString
():
String
=
"$start..$end"
}
}
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录