rename platformName annotation to jvmName
This commit is contained in:
@@ -668,7 +668,7 @@ public class JetTypeMapper {
|
||||
@NotNull
|
||||
private String mapFunctionName(@NotNull FunctionDescriptor descriptor) {
|
||||
if (!(descriptor instanceof JavaCallableMemberDescriptor)) {
|
||||
String platformName = getPlatformName(descriptor);
|
||||
String platformName = getJvmName(descriptor);
|
||||
if (platformName != null) return platformName;
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.diagnostics.rendering.Renderers;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.renderer.Renderer;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.rendering.Renderers.STRING;
|
||||
|
||||
public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
|
||||
private static final Renderer<ConflictingJvmDeclarationsData> CONFLICTING_JVM_DECLARATIONS_DATA = new Renderer<ConflictingJvmDeclarationsData>() {
|
||||
@@ -50,6 +52,8 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "''jvmOverloads'' annotation has no effect for methods without default arguments");
|
||||
MAP.put(ErrorsJvm.OVERLOADS_ABSTRACT, "''jvmOverloads'' annotation cannot be used on abstract methods");
|
||||
MAP.put(ErrorsJvm.OVERLOADS_PRIVATE, "''jvmOverloads'' annotation has no effect on private and local declarations");
|
||||
MAP.put(ErrorsJvm.INAPPLICABLE_JVM_NAME, "''jvmName'' annotation is not applicable to this declaration");
|
||||
MAP.put(ErrorsJvm.ILLEGAL_JVM_NAME, "Illegal JVM name: ''{0}''", STRING);
|
||||
MAP.put(ErrorsJvm.NATIVE_DECLARATION_CANNOT_BE_ABSTRACT, "Native declaration can not be abstract");
|
||||
MAP.put(ErrorsJvm.NATIVE_DECLARATION_CANNOT_HAVE_BODY, "Native declaration can not have a body");
|
||||
MAP.put(ErrorsJvm.NATIVE_DECLARATION_IN_TRAIT, "Members of interfaces can not be native");
|
||||
|
||||
@@ -42,6 +42,9 @@ public interface ErrorsJvm {
|
||||
DiagnosticFactory0<JetDeclaration> OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<JetDeclaration> JVM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_JVM_NAME = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<JetAnnotationEntry, String> ILLEGAL_JVM_NAME = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<JetDeclaration> OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<JetDeclaration> OVERLOADS_ABSTRACT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<JetDeclaration> OVERLOADS_PRIVATE = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
|
||||
|
||||
+41
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.cfg.WhenChecker
|
||||
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||
import org.jetbrains.kotlin.container.useImpl
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
@@ -32,6 +33,7 @@ import org.jetbrains.kotlin.load.kotlin.JavaAnnotationCallChecker
|
||||
import org.jetbrains.kotlin.load.kotlin.JavaAnnotationMethodCallChecker
|
||||
import org.jetbrains.kotlin.load.kotlin.nativeDeclarations.NativeFunChecker
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.annotations.findPublicFieldAnnotation
|
||||
@@ -61,6 +63,7 @@ public object JvmPlatformConfigurator : PlatformConfigurator(
|
||||
DynamicTypesSettings(),
|
||||
additionalDeclarationCheckers = listOf(
|
||||
PlatformStaticAnnotationChecker(),
|
||||
JvmNameAnnotationChecker(),
|
||||
LocalFunInlineChecker(),
|
||||
ReifiedTypeParameterAnnotationChecker(),
|
||||
NativeFunChecker(),
|
||||
@@ -164,6 +167,44 @@ public class PlatformStaticAnnotationChecker : DeclarationChecker {
|
||||
}
|
||||
}
|
||||
|
||||
public class JvmNameAnnotationChecker : DeclarationChecker {
|
||||
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink, bindingContext: BindingContext) {
|
||||
val platformNameAnnotation = DescriptorUtils.getJvmNameAnnotation(descriptor)
|
||||
if (platformNameAnnotation != null) {
|
||||
checkDeclaration(descriptor, platformNameAnnotation, diagnosticHolder)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkDeclaration(descriptor: DeclarationDescriptor,
|
||||
annotation: AnnotationDescriptor,
|
||||
diagnosticHolder: DiagnosticSink) {
|
||||
val annotationEntry = DescriptorToSourceUtils.getSourceFromAnnotation(annotation) ?: return
|
||||
|
||||
if (descriptor is FunctionDescriptor && !isRenamableFunction(descriptor)) {
|
||||
diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry))
|
||||
}
|
||||
|
||||
val value = DescriptorUtils.getJvmName(descriptor)
|
||||
if (value == null || !Name.isValidIdentifier(value)) {
|
||||
diagnosticHolder.report(ErrorsJvm.ILLEGAL_JVM_NAME.on(annotationEntry, value))
|
||||
}
|
||||
|
||||
if (descriptor is CallableMemberDescriptor) {
|
||||
val callableMemberDescriptor = descriptor
|
||||
if (DescriptorUtils.isOverride(callableMemberDescriptor) || callableMemberDescriptor.modality.isOverridable) {
|
||||
diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isRenamableFunction(descriptor: FunctionDescriptor): Boolean {
|
||||
val containingDescriptor = descriptor.containingDeclaration
|
||||
|
||||
return containingDescriptor is PackageFragmentDescriptor || containingDescriptor is ClassDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class OverloadsAnnotationChecker: DeclarationChecker {
|
||||
override fun check(
|
||||
declaration: JetDeclaration,
|
||||
|
||||
@@ -114,7 +114,6 @@ public interface Errors {
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> WRONG_MODIFIER_TARGET = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> REDUNDANT_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, String> WRONG_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> INAPPLICABLE_PLATFORM_NAME = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<JetAnnotationEntry, String> WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<JetAnnotationEntry> REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@@ -243,8 +242,6 @@ public interface Errors {
|
||||
DiagnosticFactory2<JetDeclaration, CallableMemberDescriptor, String> CONFLICTING_OVERLOADS =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
||||
|
||||
DiagnosticFactory1<JetAnnotationEntry, String> ILLEGAL_PLATFORM_NAME = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<JetNamedDeclaration> NON_FINAL_MEMBER_IN_FINAL_CLASS = DiagnosticFactory0.create(WARNING, modifierSetPosition(
|
||||
JetTokens.OPEN_KEYWORD));
|
||||
|
||||
|
||||
-2
@@ -121,7 +121,6 @@ public class DefaultErrorMessages {
|
||||
MAP.put(WRONG_MODIFIER_TARGET, "Modifier ''{0}'' is not applicable to ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(REDUNDANT_MODIFIER_FOR_TARGET, "Modifier ''{0}'' is redundant for ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(WRONG_MODIFIER_CONTAINING_DECLARATION, "Modifier ''{0}'' is not applicable inside ''{1}''", TO_STRING, TO_STRING);
|
||||
MAP.put(INAPPLICABLE_PLATFORM_NAME, "platformName annotation is not applicable to this declaration");
|
||||
MAP.put(WRONG_ANNOTATION_TARGET, "This annotation is not applicable to target ''{0}''", TO_STRING);
|
||||
MAP.put(REPEATED_ANNOTATION, "This annotation is not repeatable");
|
||||
|
||||
@@ -514,7 +513,6 @@ public class DefaultErrorMessages {
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(CONFLICTING_OVERLOADS, "''{0}'' is already defined in {1}", COMPACT_WITH_MODIFIERS, STRING);
|
||||
MAP.put(ILLEGAL_PLATFORM_NAME, "Illegal platform name: ''{0}''", STRING);
|
||||
|
||||
MAP.put(FUNCTION_EXPECTED, "Expression ''{0}''{1} cannot be invoked as a function. " +
|
||||
"The function '" + OperatorConventions.INVOKE.asString() + "()' is not found",
|
||||
|
||||
@@ -122,7 +122,7 @@ public class MainFunctionDetector {
|
||||
|
||||
@NotNull
|
||||
private static String getJVMFunctionName(FunctionDescriptor functionDescriptor) {
|
||||
String platformName = DescriptorUtils.getPlatformName(functionDescriptor);
|
||||
String platformName = DescriptorUtils.getJvmName(functionDescriptor);
|
||||
if (platformName != null) {
|
||||
return platformName;
|
||||
}
|
||||
|
||||
@@ -23,20 +23,15 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1;
|
||||
import org.jetbrains.kotlin.lexer.JetKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.JetModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.StringValue;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.NESTED_CLASS_NOT_ALLOWED;
|
||||
import static org.jetbrains.kotlin.lexer.JetTokens.*;
|
||||
import static org.jetbrains.kotlin.psi.JetStubbedPsiUtil.getContainingDeclaration;
|
||||
|
||||
@@ -188,7 +183,6 @@ public class ModifiersChecker {
|
||||
checkNestedClassAllowed(modifierListOwner, descriptor);
|
||||
ModifierCheckerCore.INSTANCE$.check(modifierListOwner, trace, descriptor);
|
||||
checkTypeParametersModifiers(modifierListOwner);
|
||||
checkPlatformNameApplicability(descriptor);
|
||||
runDeclarationCheckers(modifierListOwner, descriptor);
|
||||
ClassDescriptor classDescriptor = descriptor instanceof ClassDescriptor ? (ClassDescriptor) descriptor : null;
|
||||
annotationChecker.check(modifierListOwner, trace, classDescriptor);
|
||||
@@ -198,7 +192,6 @@ public class ModifiersChecker {
|
||||
@NotNull JetDeclaration modifierListOwner,
|
||||
@NotNull DeclarationDescriptor descriptor
|
||||
) {
|
||||
checkPlatformNameApplicability(descriptor);
|
||||
runDeclarationCheckers(modifierListOwner, descriptor);
|
||||
annotationChecker.check(modifierListOwner, trace,
|
||||
descriptor instanceof ClassDescriptor ? (ClassDescriptor) descriptor : null);
|
||||
@@ -216,44 +209,6 @@ public class ModifiersChecker {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPlatformNameApplicability(@NotNull DeclarationDescriptor descriptor) {
|
||||
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformName"));
|
||||
if (annotation == null) return;
|
||||
|
||||
JetAnnotationEntry annotationEntry = DescriptorToSourceUtils.getSourceFromAnnotation(annotation);
|
||||
if (annotationEntry == null) return;
|
||||
|
||||
if (descriptor instanceof FunctionDescriptor && !isRenamableFunction((FunctionDescriptor) descriptor)) {
|
||||
trace.report(INAPPLICABLE_PLATFORM_NAME.on(annotationEntry));
|
||||
}
|
||||
|
||||
String value = null;
|
||||
Collection<ConstantValue<?>> values = annotation.getAllValueArguments().values();
|
||||
if (!values.isEmpty()) {
|
||||
ConstantValue<?> name = values.iterator().next();
|
||||
if (name instanceof StringValue) {
|
||||
value = ((StringValue) name).getValue();
|
||||
}
|
||||
}
|
||||
if (value == null || !Name.isValidIdentifier(value)) {
|
||||
trace.report(ILLEGAL_PLATFORM_NAME.on(annotationEntry, String.valueOf(value)));
|
||||
}
|
||||
|
||||
if (descriptor instanceof CallableMemberDescriptor) {
|
||||
CallableMemberDescriptor callableMemberDescriptor = (CallableMemberDescriptor) descriptor;
|
||||
if (DescriptorUtils.isOverride(callableMemberDescriptor) || callableMemberDescriptor.getModality().isOverridable()) {
|
||||
trace.report(INAPPLICABLE_PLATFORM_NAME.on(annotationEntry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isRenamableFunction(@NotNull FunctionDescriptor descriptor) {
|
||||
DeclarationDescriptor containingDescriptor = descriptor.getContainingDeclaration();
|
||||
|
||||
return containingDescriptor instanceof PackageFragmentDescriptor || containingDescriptor instanceof ClassDescriptor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<JetModifierKeywordToken, PsiElement> getTokensCorrespondingToModifiers(
|
||||
@NotNull JetModifierList modifierList,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import kotlin.platform.platformName;
|
||||
import kotlin.jvm.jvmName;
|
||||
|
||||
public class FakePlatformName {
|
||||
@platformName(name = "fake")
|
||||
@jvmName(name = "fake")
|
||||
public String foo() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
import kotlin.platform.platformName
|
||||
|
||||
@platformName("Fail")
|
||||
@jvmName("Fail")
|
||||
fun OK() {}
|
||||
|
||||
fun box() = ::OK.name
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
package test
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
@platformName("bar")
|
||||
@jvmName("bar")
|
||||
fun foo() {}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package test
|
||||
|
||||
kotlin.platform.platformName(name = "bar") internal fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal fun foo(): kotlin.Unit
|
||||
|
||||
public open class PlatformName {
|
||||
public constructor PlatformName()
|
||||
|
||||
+4
-6
@@ -1,14 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
import kotlin.platform.*
|
||||
|
||||
<!ILLEGAL_PLATFORM_NAME!>@platformName("")<!>
|
||||
<!ILLEGAL_JVM_NAME!>@jvmName("")<!>
|
||||
fun foo(a: Any) {}
|
||||
|
||||
<!ILLEGAL_PLATFORM_NAME!>@platformName(".")<!>
|
||||
<!ILLEGAL_JVM_NAME!>@jvmName(".")<!>
|
||||
fun foo() {}
|
||||
|
||||
<!ILLEGAL_PLATFORM_NAME!>@platformName("/")<!>
|
||||
<!ILLEGAL_JVM_NAME!>@jvmName("/")<!>
|
||||
fun fooSlash() {}
|
||||
|
||||
<!ILLEGAL_PLATFORM_NAME!>@platformName("<")<!>
|
||||
<!ILLEGAL_JVM_NAME!>@jvmName("<")<!>
|
||||
fun fooLT() {}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package
|
||||
|
||||
kotlin.platform.platformName(name = ".") internal fun foo(): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "<") internal fun fooLT(): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "/") internal fun fooSlash(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = ".") internal fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "<") internal fun fooLT(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "/") internal fun fooSlash(): kotlin.Unit
|
||||
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
@jvmName("a")
|
||||
fun foo() {}
|
||||
|
||||
@jvmName("b")
|
||||
fun Any.foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("c")<!>
|
||||
val px = 1
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("d")<!>
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
@jvmName("e")
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
@jvmName("f")
|
||||
get() = 1
|
||||
@jvmName("g")
|
||||
set(v) {}
|
||||
|
||||
var vardef: Int = 1
|
||||
@jvmName("h")
|
||||
get
|
||||
@jvmName("i")
|
||||
set
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("C")<!>
|
||||
class C <!WRONG_ANNOTATION_TARGET!>jvmName("primary")<!> constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>jvmName("ctr")<!> constructor(x: Int): this() {}
|
||||
|
||||
@jvmName("a")
|
||||
fun foo() {}
|
||||
|
||||
@jvmName("b")
|
||||
fun Any.foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("c")<!>
|
||||
val px = 1
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("d")<!>
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
@jvmName("e")
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
@jvmName("f")
|
||||
get() = 1
|
||||
@jvmName("g")
|
||||
set(v) {}
|
||||
}
|
||||
|
||||
fun foo1() {
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("a")<!>
|
||||
fun foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@jvmName("a")<!>
|
||||
val x = 1
|
||||
}
|
||||
|
||||
abstract class AB {
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("AB_absFun1")<!>
|
||||
abstract fun absFun1()
|
||||
|
||||
abstract fun absFun2()
|
||||
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("AB_openFun")<!>
|
||||
open fun openFun() {}
|
||||
}
|
||||
|
||||
class D: AB() {
|
||||
override fun absFun1() {}
|
||||
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("D_absFun2")<!>
|
||||
override fun absFun2() {}
|
||||
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("D_openFun")<!>
|
||||
final override fun openFun() {}
|
||||
|
||||
@jvmName("D_finalFun")
|
||||
fun finalFun() {}
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
package
|
||||
|
||||
kotlin.jvm.jvmName(name = "c") internal val px: kotlin.Int = 1
|
||||
internal val valx: kotlin.Int
|
||||
internal var vardef: kotlin.Int
|
||||
internal var varx: kotlin.Int
|
||||
kotlin.jvm.jvmName(name = "d") internal val kotlin.Any.px: kotlin.Int
|
||||
kotlin.jvm.jvmName(name = "a") internal fun foo(): kotlin.Unit
|
||||
internal fun foo1(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "b") internal fun kotlin.Any.foo(): kotlin.Unit
|
||||
|
||||
internal abstract class AB {
|
||||
public constructor AB()
|
||||
kotlin.jvm.jvmName(name = "AB_absFun1") internal abstract fun absFun1(): kotlin.Unit
|
||||
internal abstract fun absFun2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
kotlin.jvm.jvmName(name = "AB_openFun") internal open fun openFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
kotlin.jvm.jvmName(name = "C") internal final class C {
|
||||
kotlin.jvm.jvmName(name = "primary") public constructor C()
|
||||
kotlin.jvm.jvmName(name = "ctr") public constructor C(/*0*/ x: kotlin.Int)
|
||||
kotlin.jvm.jvmName(name = "c") internal final val px: kotlin.Int = 1
|
||||
internal final val valx: kotlin.Int
|
||||
internal final var varx: kotlin.Int
|
||||
kotlin.jvm.jvmName(name = "d") internal final val kotlin.Any.px: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.jvm.jvmName(name = "a") internal final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
kotlin.jvm.jvmName(name = "b") internal final fun kotlin.Any.foo(): kotlin.Unit
|
||||
}
|
||||
|
||||
internal final class D : AB {
|
||||
public constructor D()
|
||||
internal open override /*1*/ fun absFun1(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "D_absFun2") internal open override /*1*/ fun absFun2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.jvm.jvmName(name = "D_finalFun") internal final fun finalFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
kotlin.jvm.jvmName(name = "D_openFun") internal final override /*1*/ fun openFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
-91
@@ -1,91 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.platform.*
|
||||
|
||||
@platformName("a")
|
||||
fun foo() {}
|
||||
|
||||
@platformName("b")
|
||||
fun Any.foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("c")<!>
|
||||
val px = 1
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("d")<!>
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
@platformName("e")
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
@platformName("f")
|
||||
get() = 1
|
||||
@platformName("g")
|
||||
set(v) {}
|
||||
|
||||
var vardef: Int = 1
|
||||
@platformName("h")
|
||||
get
|
||||
@platformName("i")
|
||||
set
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("C")<!>
|
||||
class C <!WRONG_ANNOTATION_TARGET!>platformName("primary")<!> constructor() {
|
||||
<!WRONG_ANNOTATION_TARGET!>platformName("ctr")<!> constructor(x: Int): this() {}
|
||||
|
||||
@platformName("a")
|
||||
fun foo() {}
|
||||
|
||||
@platformName("b")
|
||||
fun Any.foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("c")<!>
|
||||
val px = 1
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("d")<!>
|
||||
val Any.px : Int
|
||||
get() = 1
|
||||
|
||||
val valx: Int
|
||||
@platformName("e")
|
||||
get() = 1
|
||||
|
||||
var varx: Int
|
||||
@platformName("f")
|
||||
get() = 1
|
||||
@platformName("g")
|
||||
set(v) {}
|
||||
}
|
||||
|
||||
fun foo1() {
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("a")<!>
|
||||
fun foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@platformName("a")<!>
|
||||
val x = 1
|
||||
}
|
||||
|
||||
abstract class AB {
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("AB_absFun1")<!>
|
||||
abstract fun absFun1()
|
||||
|
||||
abstract fun absFun2()
|
||||
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("AB_openFun")<!>
|
||||
open fun openFun() {}
|
||||
}
|
||||
|
||||
class D: AB() {
|
||||
override fun absFun1() {}
|
||||
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("D_absFun2")<!>
|
||||
override fun absFun2() {}
|
||||
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("D_openFun")<!>
|
||||
final override fun openFun() {}
|
||||
|
||||
@platformName("D_finalFun")
|
||||
fun finalFun() {}
|
||||
}
|
||||
Vendored
-45
@@ -1,45 +0,0 @@
|
||||
package
|
||||
|
||||
kotlin.platform.platformName(name = "c") internal val px: kotlin.Int = 1
|
||||
internal val valx: kotlin.Int
|
||||
internal var vardef: kotlin.Int
|
||||
internal var varx: kotlin.Int
|
||||
kotlin.platform.platformName(name = "d") internal val kotlin.Any.px: kotlin.Int
|
||||
kotlin.platform.platformName(name = "a") internal fun foo(): kotlin.Unit
|
||||
internal fun foo1(): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "b") internal fun kotlin.Any.foo(): kotlin.Unit
|
||||
|
||||
internal abstract class AB {
|
||||
public constructor AB()
|
||||
kotlin.platform.platformName(name = "AB_absFun1") internal abstract fun absFun1(): kotlin.Unit
|
||||
internal abstract fun absFun2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
kotlin.platform.platformName(name = "AB_openFun") internal open fun openFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
kotlin.platform.platformName(name = "C") internal final class C {
|
||||
kotlin.platform.platformName(name = "primary") public constructor C()
|
||||
kotlin.platform.platformName(name = "ctr") public constructor C(/*0*/ x: kotlin.Int)
|
||||
kotlin.platform.platformName(name = "c") internal final val px: kotlin.Int = 1
|
||||
internal final val valx: kotlin.Int
|
||||
internal final var varx: kotlin.Int
|
||||
kotlin.platform.platformName(name = "d") internal final val kotlin.Any.px: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "a") internal final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
kotlin.platform.platformName(name = "b") internal final fun kotlin.Any.foo(): kotlin.Unit
|
||||
}
|
||||
|
||||
internal final class D : AB {
|
||||
public constructor D()
|
||||
internal open override /*1*/ fun absFun1(): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "D_absFun2") internal open override /*1*/ fun absFun2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "D_finalFun") internal final fun finalFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
kotlin.platform.platformName(name = "D_openFun") internal final override /*1*/ fun openFun(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
-7
@@ -1,22 +1,20 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
import kotlin.platform.*
|
||||
|
||||
@platformName("bar")
|
||||
@jvmName("bar")
|
||||
fun foo(a: Any) {}
|
||||
|
||||
fun Any.foo() {}
|
||||
|
||||
@platformName("barInt")
|
||||
@jvmName("barInt")
|
||||
fun bar(x: List<Int>) {}
|
||||
|
||||
@platformName("barStr")
|
||||
@jvmName("barStr")
|
||||
fun bar(x: List<String>) {}
|
||||
|
||||
class C {
|
||||
var rwProp: Int
|
||||
@platformName("get_rwProp")
|
||||
@jvmName("get_rwProp")
|
||||
get() = 0
|
||||
@platformName("set_rwProp")
|
||||
@jvmName("set_rwProp")
|
||||
set(v) {}
|
||||
|
||||
fun getRwProp(): Int = 123
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package
|
||||
|
||||
kotlin.platform.platformName(name = "barInt") internal fun bar(/*0*/ x: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "barStr") internal fun bar(/*0*/ x: kotlin.List<kotlin.String>): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "bar") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "barInt") internal fun bar(/*0*/ x: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "barStr") internal fun bar(/*0*/ x: kotlin.List<kotlin.String>): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
internal fun kotlin.Any.foo(): kotlin.Unit
|
||||
|
||||
internal final class C {
|
||||
|
||||
Vendored
+6
-8
@@ -1,16 +1,14 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
import kotlin.platform.*
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("bar")
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@jvmName("bar")
|
||||
fun foo(a: Any)<!> {}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>fun bar(a: Any)<!> {}
|
||||
|
||||
class C {
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("foo1")
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@jvmName("foo1")
|
||||
fun foo(list: List<Int>)<!> {}
|
||||
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("foo1")
|
||||
<!CONFLICTING_JVM_DECLARATIONS!>@jvmName("foo1")
|
||||
fun foo(list: List<String>)<!> {}
|
||||
}
|
||||
|
||||
@@ -19,7 +17,7 @@ class C {
|
||||
// A1 -> B1 with accidental override
|
||||
|
||||
open class A1 {
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("bar")<!>
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
@@ -30,7 +28,7 @@ class B1 : A1() {
|
||||
// A2 -> B2 with intended override and conflicting JVM declarations
|
||||
|
||||
open class A2 {
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("bar")<!>
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
@@ -43,7 +41,7 @@ class <!CONFLICTING_JVM_DECLARATIONS!>B2<!> : A2() {
|
||||
// A3 -> B3 -> C3 with accidental override
|
||||
|
||||
open class A3 {
|
||||
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
||||
<!INAPPLICABLE_JVM_NAME!>@jvmName("bar")<!>
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+9
-9
@@ -1,12 +1,12 @@
|
||||
package
|
||||
|
||||
internal fun bar(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "bar") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
|
||||
internal open class A1 {
|
||||
public constructor A1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -14,7 +14,7 @@ internal open class A1 {
|
||||
internal open class A2 {
|
||||
public constructor A2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -22,7 +22,7 @@ internal open class A2 {
|
||||
internal open class A3 {
|
||||
public constructor A3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -31,7 +31,7 @@ internal final class B1 : A1 {
|
||||
public constructor B1()
|
||||
internal final fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -48,7 +48,7 @@ internal final class B2 : A2 {
|
||||
internal open class B3 : A3 {
|
||||
public constructor B3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -56,8 +56,8 @@ internal open class B3 : A3 {
|
||||
internal final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "foo1") internal final fun foo(/*0*/ list: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
kotlin.platform.platformName(name = "foo1") internal final fun foo(/*0*/ list: kotlin.List<kotlin.String>): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "foo1") internal final fun foo(/*0*/ list: kotlin.List<kotlin.Int>): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "foo1") internal final fun foo(/*0*/ list: kotlin.List<kotlin.String>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -66,7 +66,7 @@ internal final class C3 : B3 {
|
||||
public constructor C3()
|
||||
internal final fun bar(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
kotlin.platform.platformName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
kotlin.jvm.jvmName(name = "bar") internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+3
-3
@@ -111,9 +111,9 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("platformName.kt")
|
||||
public void testPlatformName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/platformName.kt");
|
||||
@TestMetadata("jvmName.kt")
|
||||
public void testJvmName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationApplicability/jvmName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.
|
||||
public class DescriptorUtils {
|
||||
public static final Name ENUM_VALUES = Name.identifier("values");
|
||||
public static final Name ENUM_VALUE_OF = Name.identifier("valueOf");
|
||||
public static final FqName JVM_NAME = new FqName("kotlin.jvm.jvmName");
|
||||
public static final FqName PLATFORM_NAME = new FqName("kotlin.platform.platformName");
|
||||
|
||||
private DescriptorUtils() {
|
||||
}
|
||||
@@ -552,11 +554,11 @@ public class DescriptorUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getPlatformName(@NotNull Annotated descriptor) {
|
||||
AnnotationDescriptor platformNameAnnotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformName"));
|
||||
if (platformNameAnnotation == null) return null;
|
||||
public static String getJvmName(@NotNull Annotated descriptor) {
|
||||
AnnotationDescriptor jvmNameAnnotation = getJvmNameAnnotation(descriptor);
|
||||
if (jvmNameAnnotation == null) return null;
|
||||
|
||||
Map<ValueParameterDescriptor, ConstantValue<?>> arguments = platformNameAnnotation.getAllValueArguments();
|
||||
Map<ValueParameterDescriptor, ConstantValue<?>> arguments = jvmNameAnnotation.getAllValueArguments();
|
||||
if (arguments.isEmpty()) return null;
|
||||
|
||||
ConstantValue<?> name = arguments.values().iterator().next();
|
||||
@@ -565,6 +567,14 @@ public class DescriptorUtils {
|
||||
return ((StringValue) name).getValue();
|
||||
}
|
||||
|
||||
public static AnnotationDescriptor getJvmNameAnnotation(@NotNull Annotated descriptor) {
|
||||
AnnotationDescriptor jvmNameAnnotation = descriptor.getAnnotations().findAnnotation(JVM_NAME);
|
||||
if (jvmNameAnnotation == null) {
|
||||
jvmNameAnnotation = descriptor.getAnnotations().findAnnotation(PLATFORM_NAME);
|
||||
}
|
||||
return jvmNameAnnotation;
|
||||
}
|
||||
|
||||
private static void getSubPackagesFqNames(PackageViewDescriptor packageView, Set<FqName> result) {
|
||||
FqName fqName = packageView.getFqName();
|
||||
if (!fqName.isRoot()) {
|
||||
|
||||
@@ -34,6 +34,16 @@ public annotation(retention = AnnotationRetention.BINARY, mustBeDocumented = tru
|
||||
target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class jvmStatic
|
||||
|
||||
/**
|
||||
* Specifies the name for the Java class or method
|
||||
* which is generated from this element.
|
||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#handling-signature-clashes-with-platformname)
|
||||
* for more information.
|
||||
* @property name the name of the element.
|
||||
*/
|
||||
target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class jvmName(public val name: String)
|
||||
|
||||
/**
|
||||
* Instructs the Kotlin compiler to generate a public backing field for this property.
|
||||
*/
|
||||
|
||||
@@ -18,14 +18,8 @@ package kotlin.platform
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Specifies the name for the target platform element (Java method, JavaScript function)
|
||||
* which is generated from this element.
|
||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#handling-signature-clashes-with-platformname)
|
||||
* for more information.
|
||||
* @property name the name of the element.
|
||||
*/
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
deprecated("Use kotlin.jvm.jvmName instead", ReplaceWith("kotlin.jvm.jvmName"))
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformName(public val name: String)
|
||||
|
||||
target(FUNCTION, PROPERTY, FIELD, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
|
||||
Reference in New Issue
Block a user