alternative signature applies for names

mapped in standard library (and differs from auto transformed Java signature)
e.g.Collections.copy(MutableList, List)
This commit is contained in:
Svetlana Isakova
2012-09-13 15:13:28 +04:00
parent b080c8f768
commit 0d1790a4f4
9 changed files with 91 additions and 7 deletions
@@ -0,0 +1,25 @@
import java.util.HashMap
fun box() : String {
if (!testIteratingOverMap1()) return "fail 1"
if (!testIteratingOverMap2()) return "fail 2"
return "OK"
}
fun testIteratingOverMap1() : Boolean {
val map = HashMap<String, Int>()
map.put("a", 1)
for (entry in map.entrySet()) {
entry.setValue(2)
}
return map.get("a") == 2
}
fun testIteratingOverMap2() : Boolean {
val map : MutableMap<String, Int> = HashMap<String, Int>()
map.put("a", 1)
for (entry in map.entrySet()) {
entry.setValue(2)
}
return map.get("a") == 2
}
@@ -0,0 +1,12 @@
package test;
import java.lang.UnsupportedOperationException;
import java.util.*;
import jet.runtime.typeinfo.KotlinSignature;
public class MethodWithMappedClasses {
@KotlinSignature("fun <T> copy(dest : MutableList<in T>, src : List<out T>)")
public <T> void copy(List<? super T> dest, List<? extends T> src) {
throw new UnsupportedOperationException();
}
}
@@ -0,0 +1,7 @@
package test
import java.util.*
public open class MethodWithMappedClasses : Object() {
public open fun <T> copy(p0 : MutableList<in T>, p1 : List<out T>) {}
}
@@ -0,0 +1,6 @@
namespace test
public open class test.MethodWithMappedClasses : java.lang.Object {
public final /*constructor*/ fun <init>(): test.MethodWithMappedClasses
public open fun </*0*/ T : jet.Any?>copy(/*0*/ p0: jet.MutableList<in T>, /*1*/ p1: jet.List<out T>): jet.Tuple0
}