MissingRecentApiInspection: ensure that non-direct overriding of a "recent" method does not produce a warning.

GitOrigin-RevId: 6043cb1150e563ed9e5fbcedd3574b6478aba14f
This commit is contained in:
Sergey Patrikeev
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 821de12d59
commit 27dc424f98
2 changed files with 30 additions and 6 deletions
@@ -97,9 +97,9 @@ class <error descr="'OldKotlinClass()' is available only since 2.0 but the modul
//implicit call to empty "recent" constructor available in source code.
}
class C extends OldClass {
class Overrider extends OldClass {
public C() {
public Overrider() {
//call old available constructor, to not produce warning here.
super(1);
}
@@ -109,9 +109,9 @@ class C extends OldClass {
public void <error descr="Overrides method in 'library.OldClass' that is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0. Note that the overridden method might have had a different signature in the previous IDEs.">recentMethod</error>() { }
}
class CK extends OldKotlinClass {
class KOverrider extends OldKotlinClass {
public CK() {
public KOverrider() {
//call old available constructor, to not produce warning here.
super(1);
}
@@ -121,6 +121,20 @@ class CK extends OldKotlinClass {
public void <error descr="Overrides method in 'library.OldKotlinClass' that is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0. Note that the overridden method might have had a different signature in the previous IDEs.">recentMethod</error>() { }
}
//No warning should be produced, because the `Overrider.recentMethod` is not "recent" on its own.
class JavaNonDirectOverrideOfRecentMethod extends Overrider {
@Override
public void recentMethod() {
}
}
//No warning should be produced, because the `KOverrider.recentMethod` is not "recent" on its own.
class KotlinNonDirectOverrideOfRecentMethod extends KOverrider {
@Override
public void recentMethod() {
}
}
class <error descr="Default constructor of 'library.OldClassWithDefaultConstructor' is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0.">D</error> extends OldClassWithDefaultConstructor {
//implicit call to default "recent" constructor that is NOT available in source code.
}
@@ -89,16 +89,26 @@ class A {
}
}
class Overrider : OldClass(42) {
open class Overrider : OldClass(42) {
//overrides "recent" method.
override fun <error descr="Overrides method in 'library.OldClass' that is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0. Note that the overridden method might have had a different signature in the previous IDEs.">recentMethod</error>() { }
}
class KOverrider : OldKotlinClass(42) {
open class KOverrider : OldKotlinClass(42) {
//overrides "recent" method.
override fun <error descr="Overrides method in 'library.OldKotlinClass' that is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0. Note that the overridden method might have had a different signature in the previous IDEs.">recentMethod</error>() { }
}
//No warning should be produced, because the `Overrider.recentMethod` is not "recent" on its own.
class JavaNonDirectOverrideOfRecentMethod : Overrider() {
override fun recentMethod() { }
}
//No warning should be produced, because the `KOverrider.recentMethod` is not "recent" on its own.
class KotlinNonDirectOverrideOfRecentMethod : KOverrider() {
override fun recentMethod() { }
}
class B {
@<error descr="'library.RecentAnnotation' is available only since 2.0 but the module is targeted for 1.0 - 999.0. It may lead to compatibility problems with IDEs prior to 2.0. Note that this type might have had a different fully qualified name in the previous IDEs.">RecentAnnotation</error>