Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report invisible setter error if it's resolved to synthetic property …
…of base class with public getter and protected setter ^KT-11713 Fixed
- Loading branch information
Showing
21 changed files
with
372 additions
and
36 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.fir.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// !LANGUAGE: +ImproveReportingDiagnosticsOnProtectedMembersOfBaseClass | ||
|
||
// FILE: abc/Foo.java | ||
package abc; | ||
|
||
public class Foo { | ||
public String getBar() { return ""; } | ||
protected void setBar(String x) { } | ||
public String getFoo() { return ""; } | ||
private void setFoo(String x) { } | ||
} | ||
|
||
// FILE: main.kt | ||
|
||
import abc.Foo | ||
|
||
class Data(var x: Foo) | ||
|
||
class B : Foo() { | ||
fun baz(a: Foo, t: Foo, d: Data) { | ||
a.bar = t.bar | ||
a.foo = t.foo | ||
|
||
if (d.x is B) { | ||
d.x.bar = d.x.bar + "" | ||
d.x.foo = d.x.foo + "" | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// !LANGUAGE: +ImproveReportingDiagnosticsOnProtectedMembersOfBaseClass | ||
|
||
// FILE: abc/Foo.java | ||
package abc; | ||
|
||
public class Foo { | ||
public String getBar() { return ""; } | ||
protected void setBar(String x) { } | ||
public String getFoo() { return ""; } | ||
private void setFoo(String x) { } | ||
} | ||
|
||
// FILE: main.kt | ||
|
||
import abc.Foo | ||
|
||
class Data(var x: Foo) | ||
|
||
class B : Foo() { | ||
fun baz(a: Foo, t: Foo, d: Data) { | ||
a.<!INVISIBLE_SETTER!>bar<!> = t.bar | ||
<!VAL_REASSIGNMENT!>a.foo<!> = t.foo | ||
|
||
if (d.x is B) { | ||
d.x.<!INVISIBLE_SETTER!>bar<!> = d.x.bar + "" | ||
d.x.foo = d.x.foo + "" | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package | ||
|
||
public final class B : abc.Foo { | ||
public constructor B() | ||
public final fun baz(/*0*/ a: abc.Foo, /*1*/ t: abc.Foo, /*2*/ d: Data): kotlin.Unit | ||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean | ||
public open override /*1*/ /*fake_override*/ fun getBar(): kotlin.String! | ||
public open override /*1*/ /*fake_override*/ fun getFoo(): kotlin.String! | ||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int | ||
protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun setBar(/*0*/ x: kotlin.String!): kotlin.Unit | ||
invisible_fake open override /*1*/ /*fake_override*/ fun setFoo(/*0*/ x: kotlin.String!): kotlin.Unit | ||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String | ||
} | ||
|
||
public final class Data { | ||
public constructor Data(/*0*/ x: abc.Foo) | ||
public final var x: abc.Foo | ||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean | ||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int | ||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String | ||
} | ||
|
||
package abc { | ||
|
||
public open class Foo { | ||
public constructor Foo() | ||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean | ||
public open fun getBar(): kotlin.String! | ||
public open fun getFoo(): kotlin.String! | ||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int | ||
protected/*protected and package*/ open fun setBar(/*0*/ x: kotlin.String!): kotlin.Unit | ||
private open fun setFoo(/*0*/ x: kotlin.String!): kotlin.Unit | ||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...estData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.fir.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// !LANGUAGE: -ImproveReportingDiagnosticsOnProtectedMembersOfBaseClass | ||
|
||
// FILE: abc/Foo.java | ||
package abc; | ||
|
||
public class Foo { | ||
public String getBar() { return ""; } | ||
protected void setBar(String x) { } | ||
public String getFoo() { return ""; } | ||
private void setFoo(String x) { } | ||
} | ||
|
||
// FILE: main.kt | ||
|
||
import abc.Foo | ||
|
||
class Data(var x: Foo) | ||
|
||
class B : Foo() { | ||
fun baz(a: Foo, t: Foo, d: Data) { | ||
a.bar = t.bar | ||
a.foo = t.foo | ||
|
||
if (d.x is B) { | ||
d.x.bar = d.x.bar + "" | ||
d.x.foo = d.x.foo + "" | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...er/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// !LANGUAGE: -ImproveReportingDiagnosticsOnProtectedMembersOfBaseClass | ||
|
||
// FILE: abc/Foo.java | ||
package abc; | ||
|
||
public class Foo { | ||
public String getBar() { return ""; } | ||
protected void setBar(String x) { } | ||
public String getFoo() { return ""; } | ||
private void setFoo(String x) { } | ||
} | ||
|
||
// FILE: main.kt | ||
|
||
import abc.Foo | ||
|
||
class Data(var x: Foo) | ||
|
||
class B : Foo() { | ||
fun baz(a: Foo, t: Foo, d: Data) { | ||
a.bar = t.bar | ||
<!VAL_REASSIGNMENT!>a.foo<!> = t.foo | ||
|
||
if (d.x is B) { | ||
d.x.bar = d.x.bar + "" | ||
d.x.foo = d.x.foo + "" | ||
} | ||
} | ||
} |
Oops, something went wrong.