A case for extending a raw Comparator
This commit is contained in:
+8
-1
@@ -161,7 +161,14 @@ public class JavaTypeTransformer {
|
|||||||
if (classType.isRaw()) {
|
if (classType.isRaw()) {
|
||||||
List<TypeParameterDescriptor> parameters = classData.getTypeConstructor().getParameters();
|
List<TypeParameterDescriptor> parameters = classData.getTypeConstructor().getParameters();
|
||||||
for (TypeParameterDescriptor parameter : parameters) {
|
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 {
|
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",
|
doTest(dir + "/expected.txt",
|
||||||
javaDir + "/MyEnum.java");
|
javaDir + "/MyEnum.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRawSuperType() throws Exception {
|
||||||
|
String dir = PATH + "/rawSuperType/";
|
||||||
|
doTest(dir + "RawSuperType.txt",
|
||||||
|
dir + "RawSuperType.java");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user