New J2K: fix UninitializedPropertyAccessException when calculating type of anonymous class

#KT-35395 fixed
This commit is contained in:
Ilya Kirillov
2020-01-09 13:48:45 +03:00
parent 7882f566be
commit 6a8a68a263
6 changed files with 83 additions and 0 deletions
@@ -0,0 +1,15 @@
interface Foo {
}
public class Bar {
void test() {
new Foo() {
void foo() {
bug(this);
}
};
}
void bug(Foo foo) {
}
}
@@ -0,0 +1,13 @@
// ERROR: 'public' function exposes its 'internal' parameter type Foo
internal interface Foo
class Bar {
fun test() {
object : Foo {
fun foo() {
bug(this)
}
}
}
fun bug(foo: Foo?) {}
}
@@ -0,0 +1,19 @@
public class Foo {
void fail() {
new Test.FrameCallback() {
public void doFrame() {
new Test().postFrameCallbackDelayed(this);
}
};
}
}
class Test {
public interface FrameCallback {
void doFrame();
}
void postFrameCallbackDelayed(Test.FrameCallback callback) {
}
}
@@ -0,0 +1,19 @@
import Test.FrameCallback
class Foo {
fun fail() {
object : FrameCallback {
override fun doFrame() {
Test().postFrameCallbackDelayed(this)
}
}
}
}
internal class Test {
interface FrameCallback {
fun doFrame()
}
fun postFrameCallbackDelayed(callback: FrameCallback?) {}
}