Property with all accessors deprecated considered as deprecated

This commit is contained in:
Valentin Kipyatkov
2015-10-19 19:40:17 +03:00
parent 8e6b0a26bb
commit 73176fae17
4 changed files with 52 additions and 1 deletions
@@ -1019,7 +1019,16 @@ public abstract class KotlinBuiltIns {
}
public static boolean isDeprecated(@NotNull DeclarationDescriptor declarationDescriptor) {
return containsAnnotation(declarationDescriptor, FQ_NAMES.deprecated);
if (containsAnnotation(declarationDescriptor, FQ_NAMES.deprecated)) return true;
if (declarationDescriptor instanceof PropertyDescriptor) {
boolean isVar = ((PropertyDescriptor) declarationDescriptor).isVar();
PropertyGetterDescriptor getter = ((PropertyDescriptor) declarationDescriptor).getGetter();
PropertySetterDescriptor setter = ((PropertyDescriptor) declarationDescriptor).getSetter();
return getter != null && isDeprecated(getter) && (!isVar || setter != null && isDeprecated(setter));
}
return false;
}
public static boolean isSuppressAnnotation(@NotNull AnnotationDescriptor annotationDescriptor) {
@@ -0,0 +1,27 @@
interface JavaClass{
/**
* @deprecated
*/
public int getSomething1();
/**
* @deprecated
*/
public int getSomething2();
public void setSomething2(int value);
public int getSomething3();
/**
* @deprecated
*/
public void setSomething3(int value);
/**
* @deprecated
*/
public int getSomething4();
/**
* @deprecated
*/
public void setSomething4(int value);
}
@@ -0,0 +1,9 @@
fun foo(javaClass: JavaClass) {
javaClass.<caret>
}
// WITH_ORDER
// EXIST: { lookupString: "something2", attributes: "bold" }
// EXIST: { lookupString: "something3", attributes: "bold" }
// EXIST: { lookupString: "something1", attributes: "bold strikeout" }
// EXIST: { lookupString: "something4", attributes: "bold strikeout" }
@@ -329,6 +329,12 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
doTest(fileName);
}
@TestMetadata("SyntheticExtensionDeprecated")
public void testSyntheticExtensionDeprecated() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/SyntheticExtensionDeprecated/");
doTest(fileName);
}
@TestMetadata("SyntheticExtensionForGenericClass")
public void testSyntheticExtensionForGenericClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/SyntheticExtensionForGenericClass/");