J2K: specify type for variables with anonymous type if they have write accesses
This commit is contained in:
@@ -25,4 +25,37 @@ class A {
|
||||
field9 = null;
|
||||
field10 = null;
|
||||
}
|
||||
|
||||
interface I
|
||||
|
||||
private I anonymous = new I() {
|
||||
};
|
||||
|
||||
public I anonymous2 = new I() {
|
||||
};
|
||||
|
||||
private I anonymous3 = new I() {
|
||||
};
|
||||
|
||||
private I iimpl = anonymous;
|
||||
|
||||
void testAnonymousObject(Object i) {
|
||||
if (true) {
|
||||
iimpl = (I) i;
|
||||
}
|
||||
else if (true) {
|
||||
anonymous3 = (I) i;
|
||||
}
|
||||
|
||||
I anonymousLocal1 = new I() {
|
||||
};
|
||||
|
||||
I anonymousLocal2 = new I() {
|
||||
};
|
||||
|
||||
I iimpl = anonymousLocal1;
|
||||
if (true) {
|
||||
anonymousLocal2 = (I) i;
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -26,4 +26,41 @@ internal class A {
|
||||
field9 = null
|
||||
field10 = null
|
||||
}
|
||||
|
||||
internal interface I
|
||||
|
||||
private val anonymous: I = object : I {
|
||||
|
||||
}
|
||||
|
||||
var anonymous2: I = object : I {
|
||||
|
||||
}
|
||||
|
||||
private var anonymous3: I = object : I {
|
||||
|
||||
}
|
||||
|
||||
private var iimpl = anonymous
|
||||
|
||||
fun testAnonymousObject(i: Any) {
|
||||
if (true) {
|
||||
iimpl = i as I
|
||||
} else if (true) {
|
||||
anonymous3 = i as I
|
||||
}
|
||||
|
||||
val anonymousLocal1: I = object : I {
|
||||
|
||||
}
|
||||
|
||||
var anonymousLocal2: I = object : I {
|
||||
|
||||
}
|
||||
|
||||
val iimpl = anonymousLocal1
|
||||
if (true) {
|
||||
anonymousLocal2 = i as I
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user