Fixed problem with overriding method with non-trivial raw type (when erased type parameter has upper bound)

Also added cases for the code which was changed.
This commit is contained in:
Evgeny Gerashchenko
2014-02-06 00:09:59 +04:00
parent 2d31d62163
commit ce7e0a7457
12 changed files with 110 additions and 16 deletions
@@ -0,0 +1,15 @@
//FILE: Foo.java
public class Foo<T extends CharSequence> {
}
//FILE: Bar.java
public interface Bar {
void f(Foo f);
}
//FILE: a.kt
class BarImpl: Bar {
override fun f(f: Foo<out CharSequence?>?) {
throw UnsupportedOperationException()
}
}
@@ -0,0 +1,11 @@
package test;
public interface RawTypeWithUpperBound {
public interface Foo<T extends CharSequence> {
}
interface Bar {
void f(Foo f);
}
}
@@ -0,0 +1,15 @@
package test
public trait RawTypeWithUpperBound : java.lang.Object {
public trait Bar : java.lang.Object {
public abstract fun f(/*0*/ p0: test.RawTypeWithUpperBound.Foo<out jet.CharSequence?>?): jet.Unit
}
public trait Foo</*0*/ T : jet.CharSequence?> : java.lang.Object {
}
}
package test.RawTypeWithUpperBound {
public /*synthesized*/ fun Bar(/*0*/ function: (test.RawTypeWithUpperBound.Foo<out jet.CharSequence?>?) -> jet.Unit): test.RawTypeWithUpperBound.Bar
}
@@ -0,0 +1,4 @@
package test;
public interface RawUpperBound<T extends RawUpperBound> {
}
@@ -0,0 +1,4 @@
package test
public trait RawUpperBound</*0*/ T : test.RawUpperBound<out jet.Any?>?> : java.lang.Object {
}
@@ -0,0 +1,4 @@
package test;
public interface RecursiveRawUpperBound<T extends RecursiveRawUpperBound> {
}
@@ -0,0 +1,4 @@
package test
public trait RecursiveRawUpperBound</*0*/ T : test.RecursiveRawUpperBound<out jet.Any?>?> : java.lang.Object {
}
@@ -0,0 +1,4 @@
package test;
public interface RecursiveWildcardUpperBound<T extends RecursiveWildcardUpperBound> {
}
@@ -0,0 +1,4 @@
package test
public trait RecursiveWildcardUpperBound</*0*/ T : test.RecursiveWildcardUpperBound<out jet.Any?>?> : java.lang.Object {
}
@@ -4558,6 +4558,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest("compiler/testData/diagnostics/tests/j+k/mutableIterator.kt");
}
@TestMetadata("overrideRawType.kt")
public void testOverrideRawType() throws Exception {
doTest("compiler/testData/diagnostics/tests/j+k/overrideRawType.kt");
}
@TestMetadata("OverrideVararg.kt")
public void testOverrideVararg() throws Exception {
doTest("compiler/testData/diagnostics/tests/j+k/OverrideVararg.kt");
@@ -59,6 +59,26 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/PackageLocalVisibility.java");
}
@TestMetadata("RawTypeWithUpperBound.java")
public void testRawTypeWithUpperBound() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/RawTypeWithUpperBound.java");
}
@TestMetadata("RawUpperBound.java")
public void testRawUpperBound() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/RawUpperBound.java");
}
@TestMetadata("RecursiveRawUpperBound.java")
public void testRecursiveRawUpperBound() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/RecursiveRawUpperBound.java");
}
@TestMetadata("RecursiveWildcardUpperBound.java")
public void testRecursiveWildcardUpperBound() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/RecursiveWildcardUpperBound.java");
}
@TestMetadata("SubclassFromNested.java")
public void testSubclassFromNested() throws Exception {
doTestCompiledJava("compiler/testData/loadJava/compiledJava/SubclassFromNested.java");