A case for extending a raw Comparator

This commit is contained in:
Andrey Breslav
2012-12-04 17:10:26 +04:00
parent aef96e93cf
commit 932d29e2ef
4 changed files with 46 additions and 1 deletions
@@ -161,7 +161,14 @@ public class JavaTypeTransformer {
if (classType.isRaw()) {
List<TypeParameterDescriptor> parameters = classData.getTypeConstructor().getParameters();
for (TypeParameterDescriptor parameter : parameters) {
arguments.add(SubstitutionUtils.makeStarProjection(parameter));
TypeProjection starProjection = SubstitutionUtils.makeStarProjection(parameter);
if (howThisTypeIsUsed == SUPERTYPE) {
// projections are not allowed in immediate arguments of supertypes
arguments.add(new TypeProjection(starProjection.getType()));
}
else {
arguments.add(starProjection);
}
}
}
else {
@@ -0,0 +1,20 @@
package test;
import java.lang.Object;
import java.lang.Override;
import java.lang.UnsupportedOperationException;
public class RawSuperType {
public interface Super<T> {
void foo(T t);
}
public class Derived implements Super {
@Override
public void foo(Object o) {
throw new UnsupportedOperationException();
}
}
}
@@ -0,0 +1,12 @@
namespace test
public open class test.RawSuperType : java.lang.Object {
public final /*constructor*/ fun <init>(): test.RawSuperType
public open class test.RawSuperType.Derived : test.RawSuperType.Super<jet.Any?> {
public final /*constructor*/ fun <init>(): test.RawSuperType.Derived
public open override /*1*/ fun foo(/*0*/ p0: jet.Any?): jet.Tuple0
}
public abstract trait test.RawSuperType.Super</*0*/ T : jet.Any?> : java.lang.Object {
public abstract fun foo(/*0*/ p0: T?): jet.Tuple0
}
}
@@ -111,4 +111,10 @@ public final class LoadJavaCustomTest extends KotlinTestWithEnvironment {
doTest(dir + "/expected.txt",
javaDir + "/MyEnum.java");
}
public void testRawSuperType() throws Exception {
String dir = PATH + "/rawSuperType/";
doTest(dir + "RawSuperType.txt",
dir + "RawSuperType.java");
}
}