Introduce deprecation of companion objects nested classes

Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
This commit is contained in:
Dmitry Savvinov
2017-12-14 18:59:32 +03:00
parent acd8edaa9c
commit d570b863ce
117 changed files with 8027 additions and 113 deletions
@@ -15232,6 +15232,141 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/upperBoundViolated.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/tests/objects/kt21515")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Kt21515 extends AbstractDiagnosticsTest {
public void testAllFilesPresentInKt21515() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/objects/kt21515"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotationConstructor.kt")
public void testAnnotationConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.kt");
doTest(fileName);
}
@TestMetadata("callableReferenceComplexCasesWithImportsOld.kt")
public void testCallableReferenceComplexCasesWithImportsOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferenceComplexCasesWithImportsOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesComplexCasesWithQualificationOld.kt")
public void testCallableReferencesComplexCasesWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesComplexCasesWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesNew.kt")
public void testCallableReferencesNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesOld.kt")
public void testCallableReferencesOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesOldComplexCases.kt")
public void testCallableReferencesOldComplexCases() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOldComplexCases.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesWithQualificationNew.kt")
public void testCallableReferencesWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesWithQualificationOld.kt")
public void testCallableReferencesWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectNew.kt")
public void testClassifierFromCompanionObjectNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectOld.kt")
public void testClassifierFromCompanionObjectOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectWithQualificationNew.kt")
public void testClassifierFromCompanionObjectWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectWithQualificationOld.kt")
public void testClassifierFromCompanionObjectWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("classifierIsVisibleByTwoPaths.kt")
public void testClassifierIsVisibleByTwoPaths() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierIsVisibleByTwoPaths.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedNew.kt")
public void testInheritedFromDeprecatedNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedOld.kt")
public void testInheritedFromDeprecatedOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedWithQualificationNew.kt")
public void testInheritedFromDeprecatedWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedWithQualificationOld.kt")
public void testInheritedFromDeprecatedWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorNew.kt")
public void testUseDeprecatedConstructorNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorOld.kt")
public void testUseDeprecatedConstructorOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorOld.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorWithQualificationNew.kt")
public void testUseDeprecatedConstructorWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorWithQualificationOld.kt")
public void testUseDeprecatedConstructorWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorWithQualificationOld.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/diagnostics/tests/operatorRem")
@@ -15232,6 +15232,141 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/upperBoundViolated.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/tests/objects/kt21515")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Kt21515 extends AbstractDiagnosticsUsingJavacTest {
public void testAllFilesPresentInKt21515() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/objects/kt21515"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("annotationConstructor.kt")
public void testAnnotationConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/annotationConstructor.kt");
doTest(fileName);
}
@TestMetadata("callableReferenceComplexCasesWithImportsOld.kt")
public void testCallableReferenceComplexCasesWithImportsOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferenceComplexCasesWithImportsOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesComplexCasesWithQualificationOld.kt")
public void testCallableReferencesComplexCasesWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesComplexCasesWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesNew.kt")
public void testCallableReferencesNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesOld.kt")
public void testCallableReferencesOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesOldComplexCases.kt")
public void testCallableReferencesOldComplexCases() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOldComplexCases.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesWithQualificationNew.kt")
public void testCallableReferencesWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("callableReferencesWithQualificationOld.kt")
public void testCallableReferencesWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectNew.kt")
public void testClassifierFromCompanionObjectNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectNew.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectOld.kt")
public void testClassifierFromCompanionObjectOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectOld.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectWithQualificationNew.kt")
public void testClassifierFromCompanionObjectWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("classifierFromCompanionObjectWithQualificationOld.kt")
public void testClassifierFromCompanionObjectWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierFromCompanionObjectWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("classifierIsVisibleByTwoPaths.kt")
public void testClassifierIsVisibleByTwoPaths() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/classifierIsVisibleByTwoPaths.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedNew.kt")
public void testInheritedFromDeprecatedNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedNew.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedOld.kt")
public void testInheritedFromDeprecatedOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedOld.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedWithQualificationNew.kt")
public void testInheritedFromDeprecatedWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("inheritedFromDeprecatedWithQualificationOld.kt")
public void testInheritedFromDeprecatedWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/inheritedFromDeprecatedWithQualificationOld.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorNew.kt")
public void testUseDeprecatedConstructorNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorNew.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorOld.kt")
public void testUseDeprecatedConstructorOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorOld.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorWithQualificationNew.kt")
public void testUseDeprecatedConstructorWithQualificationNew() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorWithQualificationNew.kt");
doTest(fileName);
}
@TestMetadata("useDeprecatedConstructorWithQualificationOld.kt")
public void testUseDeprecatedConstructorWithQualificationOld() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/objects/kt21515/useDeprecatedConstructorWithQualificationOld.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/diagnostics/tests/operatorRem")