Skip to content

Commit

Permalink
Mixin kotlin.Number methods into j.l.Number member scope
Browse files Browse the repository at this point in the history
 #KT-9672 Fixed
  • Loading branch information
dzharkov committed Oct 20, 2015
1 parent b389f19 commit 541001f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ object EMPTY_MEMBER_INDEX : MemberIndex {
private val ADDITIONAL_MEMBER_NAMES_MAP = mapOf(
FqName("java.util.List") to listOf(Name.identifier("removeAt")),
FqName("java.lang.CharSequence") to listOf(Name.identifier("get")),
FqName("java.util.Map") to listOf(Name.identifier("keys"), Name.identifier("entries"))
FqName("java.util.Map") to listOf(Name.identifier("keys"), Name.identifier("entries")),
FqName("java.lang.Number") to listOf(
Name.identifier("toByte"), Name.identifier("toShort"), Name.identifier("toInt"), Name.identifier("toLong"),
Name.identifier("toFloat"), Name.identifier("toDouble")
)
)

open class ClassMemberIndex(val jClass: JavaClass, val memberFilter: (JavaMember) -> Boolean) : MemberIndex {
Expand Down
10 changes: 10 additions & 0 deletions idea/idea-completion/testData/basic/java/Number.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fun test(x: java.lang.Integer) {
x.<caret>
}

// EXIST: toByte
// EXIST: toShort
// EXIST: toInt
// EXIST: toLong
// EXIST: toFloat
// EXIST: toDouble
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,12 @@ public void testNoSyntheticClasses() throws Exception {
doTest(fileName);
}

@TestMetadata("Number.kt")
public void testNumber() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/java/Number.kt");
doTest(fileName);
}

@TestMetadata("PackageDirective.kt")
public void testPackageDirective() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/java/PackageDirective.kt");
Expand Down

0 comments on commit 541001f

Please sign in to comment.