Moving platformStatic annotation to kotlin.platform package
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.jet.codegen.context.PackageContext;
|
||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedCallableMemberDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.codeFragmentUtil.CodeFragmentUtilPackage;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorToSourceUtils;
|
||||
@@ -39,8 +40,8 @@ import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaPackageFragm
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass;
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileKotlinClass;
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.incremental.IncrementalPackageFragmentProvider;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -241,15 +242,20 @@ public class JvmCodegenUtil {
|
||||
|
||||
public static boolean isPlatformStaticInObject(CallableDescriptor descriptor) {
|
||||
if (DescriptorUtils.isObject(descriptor.getContainingDeclaration())) {
|
||||
return KotlinBuiltIns.getInstance().isPlatformStatic(descriptor);
|
||||
return hasPlatformStaticAnnotation(descriptor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPlatformStaticInClassObject(CallableDescriptor descriptor) {
|
||||
if (DescriptorUtils.isClassObject(descriptor.getContainingDeclaration())) {
|
||||
return KotlinBuiltIns.getInstance().isPlatformStatic(descriptor);
|
||||
return hasPlatformStaticAnnotation(descriptor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasPlatformStaticAnnotation(@NotNull CallableDescriptor descriptor) {
|
||||
AnnotationDescriptor platformStaticAnnotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformStatic"));
|
||||
return platformStaticAnnotation != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,10 +1493,6 @@ public final annotation class noinline : kotlin.Annotation {
|
||||
/*primary*/ public constructor noinline()
|
||||
}
|
||||
|
||||
public final annotation class platformStatic : kotlin.Annotation {
|
||||
/*primary*/ public constructor platformStatic()
|
||||
}
|
||||
|
||||
public final annotation class suppress : kotlin.Annotation {
|
||||
/*primary*/ public constructor suppress(/*0*/ vararg names: kotlin.String /*kotlin.Array<kotlin.String>*/)
|
||||
internal final val names: kotlin.Array<kotlin.String>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class testAnnotation
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
class A {
|
||||
|
||||
class object {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
val b: String = "OK"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
val b: String = "OK"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
val b: String = "OK"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
class B(var s: Int = 0) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object AX {
|
||||
|
||||
platformStatic fun aStatic(): String {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
val b: String = "OK"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package test
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
class A {
|
||||
|
||||
class object {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package test
|
||||
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
object A {
|
||||
|
||||
val b: String = "OK"
|
||||
|
||||
@@ -23,5 +23,3 @@ public annotation class deprecated(val value: String)
|
||||
public annotation class suppress(vararg val names: String)
|
||||
|
||||
public annotation class tailRecursive
|
||||
|
||||
public annotation class platformStatic
|
||||
|
||||
@@ -333,11 +333,6 @@ public class KotlinBuiltIns {
|
||||
return getBuiltInClassByName("tailRecursive");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getPlatformStaticAnnotationClass() {
|
||||
return getBuiltInClassByName("platformStatic");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getDeprecatedAnnotation() {
|
||||
return getBuiltInClassByName("deprecated");
|
||||
@@ -867,10 +862,6 @@ public class KotlinBuiltIns {
|
||||
return containsAnnotation(declarationDescriptor, getTailRecursiveAnnotationClass());
|
||||
}
|
||||
|
||||
public boolean isPlatformStatic(@NotNull CallableDescriptor callableDescriptor) {
|
||||
return containsAnnotation(callableDescriptor, getPlatformStaticAnnotationClass());
|
||||
}
|
||||
|
||||
public boolean isSuppressAnnotation(@NotNull AnnotationDescriptor annotationDescriptor) {
|
||||
ClassifierDescriptor classifier = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
|
||||
return classifier != null && fqNames.suppress.equals(DescriptorUtils.getFqName(classifier));
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
|
||||
package kotlin.platform
|
||||
|
||||
public annotation class platformName(public val name: String)
|
||||
public annotation class platformName(public val name: String)
|
||||
|
||||
public annotation class platformStatic
|
||||
Reference in New Issue
Block a user