Map java.land.Deprecated to jet.deprecated

Change testData for deprecated annotation
 #KT-2947 Fixed
This commit is contained in:
Natalia.Ukhorskaya
2012-10-18 19:14:04 +04:00
parent f9c1c041d7
commit 62d8153ada
42 changed files with 107 additions and 98 deletions
@@ -22,6 +22,8 @@ import com.intellij.psi.PsiModifierListOwner;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.constants.*;
import org.jetbrains.jet.lang.resolve.java.data.ResolverClassData; import org.jetbrains.jet.lang.resolve.java.data.ResolverClassData;
import org.jetbrains.jet.lang.resolve.java.data.ResolverNamespaceData; import org.jetbrains.jet.lang.resolve.java.data.ResolverNamespaceData;
import org.jetbrains.jet.lang.resolve.java.data.ResolverScopeData; import org.jetbrains.jet.lang.resolve.java.data.ResolverScopeData;
@@ -142,4 +144,14 @@ public final class DescriptorResolverUtils {
assert psiClassQualifiedName != null : "Reading java class with no qualified name"; assert psiClassQualifiedName != null : "Reading java class with no qualified name";
return new FqNameUnsafe(psiClassQualifiedName + "." + getClassObjectName(psiClass.getName()).getName()); return new FqNameUnsafe(psiClassQualifiedName + "." + getClassObjectName(psiClass.getName()).getName());
} }
@NotNull
public static AnnotationDescriptor getAnnotationDescriptorForJavaLangDeprecated(ClassDescriptor classDescriptor) {
AnnotationDescriptor annotationDescriptor = new AnnotationDescriptor();
annotationDescriptor.setAnnotationType(classDescriptor.getDefaultType());
ValueParameterDescriptor value = getValueParameterDescriptorForAnnotationParameter(Name.identifier("value"), classDescriptor);
assert value != null : "jet.deprecated must have one parameter called value";
annotationDescriptor.setValueArgument(value, new StringValue("Deprecated in Java"));
return annotationDescriptor;
}
} }
@@ -17,11 +17,13 @@
package org.jetbrains.jet.lang.resolve.java; package org.jetbrains.jet.lang.resolve.java;
import com.google.common.collect.*; import com.google.common.collect.*;
import com.intellij.psi.CommonClassNames;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.PlatformToKotlinClassMap; import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
@@ -89,6 +91,15 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
return classDescriptorMap.get(fqName); return classDescriptorMap.get(fqName);
} }
@Nullable
public AnnotationDescriptor mapToAnnotationClass(@NotNull FqName fqName) {
ClassDescriptor classDescriptor = classDescriptorMap.get(fqName);
if (classDescriptor != null && fqName.getFqName().equals(CommonClassNames.JAVA_LANG_DEPRECATED)) {
return DescriptorResolverUtils.getAnnotationDescriptorForJavaLangDeprecated(classDescriptor);
}
return null;
}
private static FqName getJavaClassFqName(@NotNull Class<?> javaClass) { private static FqName getJavaClassFqName(@NotNull Class<?> javaClass) {
return new FqName(javaClass.getName().replace('$', '.')); return new FqName(javaClass.getName().replace('$', '.'));
} }
@@ -45,6 +45,7 @@ public abstract class JavaToKotlinClassMapBuilder {
register(Comparable.class, kotlinBuiltIns.getComparable()); register(Comparable.class, kotlinBuiltIns.getComparable());
register(Enum.class, kotlinBuiltIns.getEnum()); register(Enum.class, kotlinBuiltIns.getEnum());
register(Annotation.class, kotlinBuiltIns.getAnnotation()); register(Annotation.class, kotlinBuiltIns.getAnnotation());
register(Deprecated.class, kotlinBuiltIns.getDeprecatedAnnotation(), Direction.JAVA_TO_KOTLIN);
register(Iterable.class, kotlinBuiltIns.getIterable(), kotlinBuiltIns.getMutableIterable()); register(Iterable.class, kotlinBuiltIns.getIterable(), kotlinBuiltIns.getMutableIterable());
register(Iterator.class, kotlinBuiltIns.getIterator(), kotlinBuiltIns.getMutableIterator()); register(Iterator.class, kotlinBuiltIns.getIterator(), kotlinBuiltIns.getMutableIterator());
@@ -24,10 +24,8 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor; import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.resolve.constants.*;
import org.jetbrains.jet.lang.resolve.java.DescriptorResolverUtils; import org.jetbrains.jet.lang.resolve.java.*;
import org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
@@ -88,6 +86,12 @@ public final class JavaAnnotationResolver {
} }
FqName annotationFqName = new FqName(qname); FqName annotationFqName = new FqName(qname);
AnnotationDescriptor mappedClassDescriptor = JavaToKotlinClassMap.getInstance().mapToAnnotationClass(annotationFqName);
if (mappedClassDescriptor != null) {
return mappedClassDescriptor;
}
final ClassDescriptor annotationClass = final ClassDescriptor annotationClass =
classResolver.resolveClass(annotationFqName, DescriptorSearchRule.INCLUDE_KOTLIN, postponedTasks); classResolver.resolveClass(annotationFqName, DescriptorSearchRule.INCLUDE_KOTLIN, postponedTasks);
if (annotationClass == null) { if (annotationClass == null) {
@@ -2,4 +2,4 @@ import java.util.ArrayList
<!NONE_APPLICABLE!>ArrayList<!><Int>(1, 1) fun b() {} <!NONE_APPLICABLE!>ArrayList<!><Int>(1, 1) fun b() {}
<!UNRESOLVED_REFERENCE!>Xoo<!>(<!UNRESOLVED_REFERENCE!>x<!>) fun c() {} <!UNRESOLVED_REFERENCE!>Xoo<!>(<!UNRESOLVED_REFERENCE!>x<!>) fun c() {}
Deprecated(<!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>x<!>) fun a() {} <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Deprecated<!>(<!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>x<!>) fun a() {}
@@ -1,15 +1,15 @@
package a package a
import java.lang.Deprecated as deprecated import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Deprecated<!> as deprecated
import java.lang.SuppressWarnings as suppresswarnings import java.lang.SuppressWarnings as suppresswarnings
deprecated suppresswarnings val s: String = ""; <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>deprecated<!> suppresswarnings val s: String = "";
deprecated suppresswarnings fun main(args : Array<String>) { <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>deprecated<!> suppresswarnings fun main(args : Array<String>) {
System.out.println("Hello, world!") System.out.println("Hello, world!")
} }
class Test(deprecated val s: String, class Test(<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>deprecated<!> val s: String,
suppresswarnings val x : Int) {} suppresswarnings val x : Int) {}
@@ -1,2 +1,2 @@
annotation [java.lang.Deprecated] class my annotation [<!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Deprecated<!>] class my
annotation Deprecated class my1 annotation <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Deprecated<!> class my1
@@ -1,6 +1,5 @@
import <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Deprecated<!> as deprecated
import java.lang.Deprecated as deprecated <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Deprecated<!> fun foo() {}
Deprecated fun foo() {} <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>deprecated<!> fun foo1() {}
deprecated fun foo1() {}
@@ -1,5 +1,5 @@
package test package test
public open class AnnotatedMethod() : java.lang.Object() { public open class AnnotatedMethod() : java.lang.Object() {
public open Deprecated fun f(): Unit { } public open deprecated("Deprecated in Java") fun f(): Unit { }
} }
@@ -2,5 +2,5 @@ namespace test
public open class test.AnnotatedMethod : java.lang.Object { public open class test.AnnotatedMethod : java.lang.Object {
public final /*constructor*/ fun <init>(): test.AnnotatedMethod public final /*constructor*/ fun <init>(): test.AnnotatedMethod
public open java.lang.Deprecated() fun f(): jet.Tuple0 public open jet.deprecated(value = "Deprecated in Java") fun f(): jet.Tuple0
} }
@@ -1,4 +1,4 @@
Deprecated class MyClass() { deprecated("") class MyClass() {
} }
// TESTED_OBJECT_KIND: class // TESTED_OBJECT_KIND: class
@@ -1,5 +1,5 @@
class MyClass { class MyClass {
Deprecated class object { deprecated("") class object {
} }
} }
@@ -1,4 +1,4 @@
Deprecated enum class MyEnum { deprecated("") enum class MyEnum {
FIRST FIRST
} }
@@ -1,5 +1,5 @@
class MyClass() { class MyClass() {
Deprecated public class MyInnerClass() {} deprecated("") public class MyInnerClass() {}
} }
// TESTED_OBJECT_KIND: class // TESTED_OBJECT_KIND: class
@@ -1,4 +1,4 @@
Deprecated public trait MyTrait { deprecated("") public trait MyTrait {
} }
// TESTED_OBJECT_KIND: class // TESTED_OBJECT_KIND: class
@@ -1,6 +1,6 @@
class MyClass() { class MyClass() {
val test = "" val test = ""
[Deprecated] get [deprecated("")] get
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
@@ -1,6 +1,6 @@
class MyClass() { class MyClass() {
var test = "" var test = ""
[Deprecated] set [deprecated("")] set
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
@@ -1,6 +1,6 @@
class MyClass() { } class MyClass() { }
Deprecated fun MyClass.test() {} deprecated("") fun MyClass.test() {}
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: namespace, test // TESTED_OBJECTS: namespace, test
@@ -1,5 +1,5 @@
class MyClass() { class MyClass() {
Deprecated fun test() {} deprecated("") fun test() {}
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
@@ -1,6 +1,6 @@
class MyClass() { class MyClass() {
class object { class object {
Deprecated fun test() {} deprecated("") fun test() {}
} }
} }
@@ -1,6 +1,6 @@
class MyClass() { class MyClass() {
val test: Int val test: Int
[Deprecated] get(): Int { return 0 } [deprecated("")] get(): Int { return 0 }
} }
@@ -1,5 +1,5 @@
class MyClass() { class MyClass() {
Deprecated val test = "" deprecated("") val test = ""
} }
@@ -1,4 +1,4 @@
class MyClass(Deprecated val test: Int) {} class MyClass(deprecated("") val test: Int) {}
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: MyClass, getTest // TESTED_OBJECTS: MyClass, getTest
@@ -1,6 +1,6 @@
class MyClass() { class MyClass() {
var test = 1 var test = 1
[Deprecated] set(i: Int) { test = i } [deprecated("")] set(i: Int) { test = i }
} }
@@ -1,5 +1,5 @@
class MyClass() { class MyClass() {
Deprecated var test = "" deprecated("") var test = ""
} }
@@ -1,4 +1,4 @@
class MyClass(Deprecated var test: Int) {} class MyClass(deprecated("") var test: Int) {}
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
@@ -1,4 +1,4 @@
Deprecated fun test() {} deprecated("") fun test() {}
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: namespace, test // TESTED_OBJECTS: namespace, test
@@ -1,5 +1,5 @@
class MyClass() { class MyClass() {
Deprecated public val test: Int = 0 deprecated("") public val test: Int = 0
} }
@@ -1,4 +1,4 @@
Deprecated val test: Int = 0 deprecated("") val test: Int = 0
// TESTED_OBJECT_KIND: property // TESTED_OBJECT_KIND: property
// TESTED_OBJECTS: namespace, test // TESTED_OBJECTS: namespace, test
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall; import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
import org.jetbrains.jet.lang.resolve.calls.VariableAsFunctionResolvedCall; import org.jetbrains.jet.lang.resolve.calls.VariableAsFunctionResolvedCall;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
@@ -38,7 +37,6 @@ import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.TypeUtils; import org.jetbrains.jet.lang.types.TypeUtils;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.resolve.DescriptorRenderer;
public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisitor { public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisitor {
@@ -206,11 +204,11 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
AnnotationDescriptor deprecated = getDeprecated(descriptor); AnnotationDescriptor deprecated = getDeprecated(descriptor);
if (deprecated != null) { if (deprecated != null) {
if (isWarning) { if (isWarning) {
holder.createInfoAnnotation(element, "'" + renderName(descriptor) + "' is deprecated") holder.createInfoAnnotation(element, getMessage(deprecated))
.setTextAttributes(CodeInsightColors.WARNINGS_ATTRIBUTES); .setTextAttributes(CodeInsightColors.WARNINGS_ATTRIBUTES);
} }
else { else {
holder.createInfoAnnotation(element, "'" + renderName(descriptor) + "' is deprecated") holder.createInfoAnnotation(element, getMessage(deprecated))
.setTextAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES); .setTextAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES);
} }
return true; return true;
@@ -230,30 +228,14 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
return null; return null;
} }
private static String renderName(DeclarationDescriptor descriptor) { private static String getMessage(AnnotationDescriptor descriptor) {
if (descriptor instanceof ClassDescriptor) { ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType());
return DescriptorUtils.getFQName(descriptor).getFqName(); assert classDescriptor != null : "ClassDescriptor for jet.deprecated mustn't be null";
} ValueParameterDescriptor parameterDescriptor =
else if (descriptor instanceof ConstructorDescriptor) { DescriptorResolverUtils.getValueParameterDescriptorForAnnotationParameter(Name.identifier("value"), classDescriptor);
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); assert parameterDescriptor != null : "jet.deprecated must have one parameter called value";
assert containingDeclaration != null; CompileTimeConstant<?> valueArgument = descriptor.getValueArgument(parameterDescriptor);
return "constructor for " + containingDeclaration.getName(); assert valueArgument != null : "jet.deprecated must have value argument";
} return (String) valueArgument.getValue();
else if (descriptor instanceof PropertyGetterDescriptor) {
return "getter for " + ((PropertyGetterDescriptor) descriptor).getCorrespondingProperty().getName();
}
else if (descriptor instanceof PropertySetterDescriptor) {
return "setter for " + ((PropertySetterDescriptor) descriptor).getCorrespondingProperty().getName();
}
else if (descriptor instanceof PropertyDescriptor) {
if (((PropertyDescriptor) descriptor).isVar()) {
return "var " + descriptor.getName();
}
return "val " + descriptor.getName();
}
else if (descriptor instanceof FunctionDescriptor) {
return "fun " + descriptor.getName() + DescriptorRenderer.TEXT.renderFunctionParameters((FunctionDescriptor) descriptor);
}
return DescriptorRenderer.TEXT.render(descriptor);
} }
} }
@@ -2,7 +2,7 @@ package test
<info>import</info> java.util.ArrayList <info>import</info> java.util.ArrayList
Deprecated <info>open</info> class MyClass {} deprecated("'test.MyClass' is deprecated") <info>open</info> class MyClass {}
fun test() { fun test() {
val a : <info descr="'test.MyClass' is deprecated">MyClass</info>? = null val a : <info descr="'test.MyClass' is deprecated">MyClass</info>? = null
@@ -7,13 +7,13 @@ fun test() {
} }
class MyClass(): MyTrait { class MyClass(): MyTrait {
Deprecated class object { deprecated("'MyClass.<class-object-for-MyClass>' is deprecated") class object {
val <info>test</info>: String = "" val <info>test</info>: String = ""
} }
} }
trait MyTrait { trait MyTrait {
Deprecated class object { deprecated("'MyTrait.<class-object-for-MyTrait>' is deprecated") class object {
val <info>test</info>: String = "" val <info>test</info>: String = ""
} }
} }
@@ -6,13 +6,13 @@ fun test() {
<info descr="'fun test4(x : jet.Int, y : jet.Int)' is deprecated">test4</info>(1, 2) <info descr="'fun test4(x : jet.Int, y : jet.Int)' is deprecated">test4</info>(1, 2)
} }
Deprecated fun test1() { } deprecated("'fun test1()' is deprecated") fun test1() { }
Deprecated fun test4(x: Int, y: Int) { } deprecated("'fun test4(x : jet.Int, y : jet.Int)' is deprecated") fun test4(x: Int, y: Int) { }
class MyClass() { class MyClass() {
Deprecated fun test2() {} deprecated("'fun test2()' is deprecated") fun test2() {}
class object { class object {
Deprecated fun test3() {} deprecated("'fun test3()' is deprecated") fun test3() {}
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
class MyClass {} class MyClass {}
Deprecated fun MyClass.get(i: MyClass): MyClass { return MyClass() } deprecated("'fun get(i : MyClass)' is deprecated") fun MyClass.get(i: MyClass): MyClass { return MyClass() }
fun test() { fun test() {
val x1 = MyClass() val x1 = MyClass()
@@ -9,11 +9,11 @@ fun test() {
class MyClass() { class MyClass() {
<info>public</info> val <info>test1</info>: String = "" <info>public</info> val <info>test1</info>: String = ""
[Deprecated] <info descr="null">get</info> [deprecated("'getter for test1' is deprecated")] <info>get</info>
<info>public</info> var <info>test2</info>: String = "" <info>public</info> var <info>test2</info>: String = ""
[Deprecated] <info descr="null">get</info> [deprecated("'getter for test2' is deprecated")] <info>get</info>
Deprecated <info>public</info> val <info>test3</info>: String = "" deprecated("'val test3' is deprecated") <info>public</info> val <info>test3</info>: String = ""
[Deprecated] <info>get</info> [deprecated("'getter for test3' is deprecated")] <info>get</info>
} }
+1 -1
View File
@@ -1,6 +1,6 @@
class MyClass {} class MyClass {}
Deprecated fun MyClass.inc(): MyClass { return MyClass() } deprecated("'fun inc()' is deprecated") fun MyClass.inc(): MyClass { return MyClass() }
fun test() { fun test() {
var x3 = MyClass() var x3 = MyClass()
@@ -1,6 +1,6 @@
class MyRunnable() {} class MyRunnable() {}
Deprecated fun MyRunnable.invoke() { deprecated("'fun invoke()' is deprecated") fun MyRunnable.invoke() {
} }
fun test() { fun test() {
@@ -1,18 +1,18 @@
class MyClass {} class MyClass {}
Deprecated fun MyClass.minus(i: MyClass) { } deprecated("'fun minus(i : MyClass)' is deprecated") fun MyClass.minus(i: MyClass) { }
Deprecated fun MyClass.div(i: MyClass) { } deprecated("'fun div(i : MyClass)' is deprecated") fun MyClass.div(i: MyClass) { }
Deprecated fun MyClass.times(i: MyClass) { } deprecated("'fun times(i : MyClass)' is deprecated") fun MyClass.times(i: MyClass) { }
Deprecated fun MyClass.not() { } deprecated("'fun not()' is deprecated") fun MyClass.not() { }
Deprecated fun MyClass.plus() { } deprecated("'fun plus()' is deprecated") fun MyClass.plus() { }
Deprecated fun MyClass.contains(i: MyClass): Boolean { return false } deprecated("'fun contains(i : MyClass)' is deprecated") fun MyClass.contains(i: MyClass): Boolean { return false }
Deprecated fun MyClass.plusAssign(i: MyClass) { } deprecated("'fun plusAssign(i : MyClass)' is deprecated") fun MyClass.plusAssign(i: MyClass) { }
Deprecated fun MyClass.equals(i: Any?): Boolean { return false } deprecated("'fun equals(i : jet.Any?)' is deprecated") fun MyClass.equals(i: Any?): Boolean { return false }
Deprecated fun MyClass.compareTo(i: MyClass): Int { return 0 } deprecated("'fun compareTo(i : MyClass)' is deprecated") fun MyClass.compareTo(i: MyClass): Int { return 0 }
fun test() { fun test() {
val x1 = MyClass() val x1 = MyClass()
@@ -8,15 +8,15 @@ fun test() {
MyClass.<info descr="'var test6' is deprecated">test6</info> MyClass.<info descr="'var test6' is deprecated">test6</info>
} }
Deprecated val <info>test1</info>: String = "" deprecated("'val test1' is deprecated") val <info>test1</info>: String = ""
Deprecated var <info>test4</info>: String = "" deprecated("'var test4' is deprecated") var <info>test4</info>: String = ""
class MyClass() { class MyClass() {
Deprecated val <info>test2</info>: String = "" deprecated("'val test2' is deprecated") val <info>test2</info>: String = ""
Deprecated var <info>test5</info>: String = "" deprecated("'var test5' is deprecated") var <info>test5</info>: String = ""
class object { class object {
Deprecated val <info>test3</info>: String = "" deprecated("'val test3' is deprecated") val <info>test3</info>: String = ""
Deprecated var <info>test6</info>: String = "" deprecated("'var test6' is deprecated") var <info>test6</info>: String = ""
} }
} }
@@ -1,6 +1,6 @@
class MyClass { } class MyClass { }
Deprecated fun MyClass.rangeTo(i: MyClass): IntIterator { deprecated("'fun rangeTo(i : MyClass)' is deprecated") fun MyClass.rangeTo(i: MyClass): IntIterator {
throw Exception() throw Exception()
} }
@@ -19,8 +19,8 @@ fun test() {
class MyClass() { class MyClass() {
<info>public</info> var <info>test1</info>: Int = 0 <info>public</info> var <info>test1</info>: Int = 0
[Deprecated] <info>set</info> [deprecated("'setter for test1' is deprecated")] <info>set</info>
} }
<info>public</info> var <info>test2</info>: Int = 0 <info>public</info> var <info>test2</info>: Int = 0
[Deprecated] <info>set</info> [deprecated("'setter for test2' is deprecated")] <info>set</info>
@@ -1,4 +1,4 @@
Deprecated trait MyTrait { } deprecated("'MyTrait' is deprecated") trait MyTrait { }
fun test() { fun test() {
val a: <info descr="'MyTrait' is deprecated">MyTrait</info>? = null val a: <info descr="'MyTrait' is deprecated">MyTrait</info>? = null