rename platformStatic to jvmStatic
This commit is contained in:
+2
-2
@@ -45,8 +45,8 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
|||||||
static {
|
static {
|
||||||
MAP.put(ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
MAP.put(ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
||||||
MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
||||||
MAP.put(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'");
|
MAP.put(ErrorsJvm.JVM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'");
|
||||||
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be 'platformStatic' in object");
|
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be 'jvmStatic' in object");
|
||||||
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "''jvmOverloads'' annotation has no effect for methods without default arguments");
|
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_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.OVERLOADS_PRIVATE, "''jvmOverloads'' annotation has no effect on private and local declarations");
|
||||||
|
|||||||
+1
-3
@@ -18,8 +18,6 @@ package org.jetbrains.kotlin.resolve.jvm.diagnostics;
|
|||||||
|
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory0;
|
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory0;
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1;
|
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory1;
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory2;
|
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory2;
|
||||||
@@ -42,7 +40,7 @@ public interface ErrorsJvm {
|
|||||||
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
||||||
|
|
||||||
DiagnosticFactory0<JetDeclaration> OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<JetDeclaration> OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||||
DiagnosticFactory0<JetDeclaration> PLATFORM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<JetDeclaration> JVM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||||
|
|
||||||
DiagnosticFactory0<JetDeclaration> OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<JetDeclaration> OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
|
||||||
DiagnosticFactory0<JetDeclaration> OVERLOADS_ABSTRACT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<JetDeclaration> OVERLOADS_ABSTRACT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||||
|
|||||||
+1
-1
@@ -150,7 +150,7 @@ public class PlatformStaticAnnotationChecker : DeclarationChecker {
|
|||||||
container.getContainingDeclaration().let { DescriptorUtils.isClass(it) || DescriptorUtils.isEnumClass(it) }
|
container.getContainingDeclaration().let { DescriptorUtils.isClass(it) || DescriptorUtils.isEnumClass(it) }
|
||||||
|
|
||||||
if (!insideObject && !insideCompanionObjectInClass) {
|
if (!insideObject && !insideCompanionObjectInClass) {
|
||||||
diagnosticHolder.report(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT.on(declaration))
|
diagnosticHolder.report(ErrorsJvm.JVM_STATIC_NOT_IN_OBJECT.on(declaration))
|
||||||
}
|
}
|
||||||
|
|
||||||
val checkDeclaration = when(declaration) {
|
val checkDeclaration = when(declaration) {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
|
|
||||||
public fun DeclarationDescriptor.hasInlineAnnotation(): Boolean {
|
public fun DeclarationDescriptor.hasInlineAnnotation(): Boolean {
|
||||||
@@ -29,7 +28,8 @@ public fun DeclarationDescriptor.hasInlineAnnotation(): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun DeclarationDescriptor.hasPlatformStaticAnnotation(): Boolean {
|
public fun DeclarationDescriptor.hasPlatformStaticAnnotation(): Boolean {
|
||||||
return getAnnotations().findAnnotation(FqName("kotlin.platform.platformStatic")) != null
|
return getAnnotations().findAnnotation(FqName("kotlin.platform.platformStatic")) != null ||
|
||||||
|
getAnnotations().findAnnotation(FqName("kotlin.jvm.jvmStatic")) != null
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun DeclarationDescriptor.findPublicFieldAnnotation(): AnnotationDescriptor? {
|
public fun DeclarationDescriptor.findPublicFieldAnnotation(): AnnotationDescriptor? {
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
annotation(retention = AnnotationRetention.RUNTIME) class testAnnotation
|
annotation(retention = AnnotationRetention.RUNTIME) class testAnnotation
|
||||||
|
|
||||||
@@ -7,14 +7,14 @@ class A {
|
|||||||
companion object {
|
companion object {
|
||||||
val b: String = "OK"
|
val b: String = "OK"
|
||||||
|
|
||||||
platformStatic testAnnotation fun test1() = b
|
jvmStatic testAnnotation fun test1() = b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object B {
|
object B {
|
||||||
val b: String = "OK"
|
val b: String = "OK"
|
||||||
|
|
||||||
platformStatic testAnnotation fun test1() = b
|
jvmStatic testAnnotation fun test1() = b
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+5
-5
@@ -1,17 +1,17 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val b: String = "OK"
|
val b: String = "OK"
|
||||||
|
|
||||||
platformStatic val c: String = "OK"
|
jvmStatic val c: String = "OK"
|
||||||
|
|
||||||
platformStatic fun test1() = b
|
jvmStatic fun test1() = b
|
||||||
|
|
||||||
platformStatic fun test2() = b
|
jvmStatic fun test2() = b
|
||||||
|
|
||||||
platformStatic fun String.test3() = this + b
|
jvmStatic fun String.test3() = this + b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
enum class A {
|
enum class A {
|
||||||
;
|
;
|
||||||
companion object {
|
companion object {
|
||||||
val foo: String = "OK"
|
val foo: String = "OK"
|
||||||
|
|
||||||
platformStatic val bar: String = "OK"
|
jvmStatic val bar: String = "OK"
|
||||||
|
|
||||||
platformStatic fun baz() = foo
|
jvmStatic fun baz() = foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
|
|
||||||
val b: String = "OK"
|
val b: String = "OK"
|
||||||
|
|
||||||
platformStatic val c: String = "OK"
|
jvmStatic val c: String = "OK"
|
||||||
|
|
||||||
platformStatic fun test1() = b
|
jvmStatic fun test1() = b
|
||||||
|
|
||||||
platformStatic fun test2() = b
|
jvmStatic fun test2() = b
|
||||||
|
|
||||||
platformStatic fun String.test3() = this + b
|
jvmStatic fun String.test3() = this + b
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
class A {
|
class A {
|
||||||
<!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor() {}
|
<!WRONG_ANNOTATION_TARGET!>jvmStatic<!> constructor() {}
|
||||||
inner class B {
|
inner class B {
|
||||||
<!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor() {}
|
<!WRONG_ANNOTATION_TARGET!>jvmStatic<!> constructor() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class C <!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor()
|
class C <!WRONG_ANNOTATION_TARGET!>jvmStatic<!> constructor()
|
||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
internal final class A {
|
internal final class A {
|
||||||
kotlin.platform.platformStatic() public constructor A()
|
kotlin.jvm.jvmStatic() public constructor A()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
internal final inner class B {
|
internal final inner class B {
|
||||||
kotlin.platform.platformStatic() public constructor B()
|
kotlin.jvm.jvmStatic() public constructor B()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
@@ -15,7 +15,7 @@ internal final class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal final class C {
|
internal final class C {
|
||||||
kotlin.platform.platformStatic() public constructor C()
|
kotlin.jvm.jvmStatic() public constructor C()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
Vendored
+9
-9
@@ -1,5 +1,5 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
abstract class A {
|
abstract class A {
|
||||||
|
|
||||||
@@ -12,24 +12,24 @@ abstract class A {
|
|||||||
|
|
||||||
object B: A() {
|
object B: A() {
|
||||||
|
|
||||||
<!OVERRIDE_CANNOT_BE_STATIC!>@platformStatic override fun a()<!> {}
|
<!OVERRIDE_CANNOT_BE_STATIC!>@jvmStatic override fun a()<!> {}
|
||||||
|
|
||||||
<!OVERRIDE_CANNOT_BE_STATIC!>@platformStatic override fun b()<!> {}
|
<!OVERRIDE_CANNOT_BE_STATIC!>@jvmStatic override fun b()<!> {}
|
||||||
|
|
||||||
<!OVERRIDE_CANNOT_BE_STATIC!>@platformStatic final override fun c()<!> {}
|
<!OVERRIDE_CANNOT_BE_STATIC!>@jvmStatic final override fun c()<!> {}
|
||||||
|
|
||||||
@platformStatic open fun d() {}
|
@jvmStatic open fun d() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
|
|
||||||
companion object: A() {
|
companion object: A() {
|
||||||
@platformStatic override fun a() {}
|
@jvmStatic override fun a() {}
|
||||||
|
|
||||||
@platformStatic override fun b() {}
|
@jvmStatic override fun b() {}
|
||||||
|
|
||||||
@platformStatic final override fun c() {}
|
@jvmStatic final override fun c() {}
|
||||||
|
|
||||||
@platformStatic open fun d() {}
|
@jvmStatic open fun d() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vendored
+8
-8
@@ -12,10 +12,10 @@ internal abstract class A {
|
|||||||
|
|
||||||
internal object B : A {
|
internal object B : A {
|
||||||
private constructor B()
|
private constructor B()
|
||||||
kotlin.platform.platformStatic() internal open override /*1*/ fun a(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open override /*1*/ fun a(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal open override /*1*/ fun b(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open override /*1*/ fun b(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal final override /*1*/ fun c(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final override /*1*/ fun c(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal open fun d(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open fun d(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
@@ -29,10 +29,10 @@ internal final class C {
|
|||||||
|
|
||||||
public companion object Companion : A {
|
public companion object Companion : A {
|
||||||
private constructor Companion()
|
private constructor Companion()
|
||||||
kotlin.platform.platformStatic() internal open override /*1*/ fun a(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open override /*1*/ fun a(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal open override /*1*/ fun b(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open override /*1*/ fun b(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal final override /*1*/ fun c(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final override /*1*/ fun c(): kotlin.Unit
|
||||||
kotlin.platform.platformStatic() internal open fun d(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open fun d(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
+9
-9
@@ -1,54 +1,54 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
companion object {
|
companion object {
|
||||||
platformStatic fun a1() {
|
jvmStatic fun a1() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
platformStatic fun a2() {
|
jvmStatic fun a2() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val s = object {
|
val s = object {
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>platformStatic fun a3()<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>jvmStatic fun a3()<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>platformStatic fun a4()<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>jvmStatic fun a4()<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface B {
|
interface B {
|
||||||
companion object {
|
companion object {
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>platformStatic fun a1()<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>jvmStatic fun a1()<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
platformStatic fun a2() {
|
jvmStatic fun a2() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val s = object {
|
val s = object {
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>platformStatic fun a3()<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>jvmStatic fun a3()<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>platformStatic fun a4()<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>jvmStatic fun a4()<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -2,7 +2,7 @@ package
|
|||||||
|
|
||||||
internal final class A {
|
internal final class A {
|
||||||
public constructor A()
|
public constructor A()
|
||||||
kotlin.platform.platformStatic() internal final fun a4(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun a4(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
internal final fun test(): kotlin.Unit
|
internal final fun test(): kotlin.Unit
|
||||||
@@ -10,7 +10,7 @@ internal final class A {
|
|||||||
|
|
||||||
internal object A {
|
internal object A {
|
||||||
private constructor A()
|
private constructor A()
|
||||||
kotlin.platform.platformStatic() internal final fun a2(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun a2(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
@@ -18,7 +18,7 @@ internal final class A {
|
|||||||
|
|
||||||
public companion object Companion {
|
public companion object Companion {
|
||||||
private constructor Companion()
|
private constructor Companion()
|
||||||
kotlin.platform.platformStatic() internal final fun a1(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun a1(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
@@ -26,7 +26,7 @@ internal final class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal interface B {
|
internal interface B {
|
||||||
kotlin.platform.platformStatic() internal open fun a4(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open fun a4(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
internal open fun test(): kotlin.Unit
|
internal open fun test(): kotlin.Unit
|
||||||
@@ -34,7 +34,7 @@ internal interface B {
|
|||||||
|
|
||||||
internal object A {
|
internal object A {
|
||||||
private constructor A()
|
private constructor A()
|
||||||
kotlin.platform.platformStatic() internal final fun a2(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun a2(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
@@ -42,7 +42,7 @@ internal interface B {
|
|||||||
|
|
||||||
public companion object Companion {
|
public companion object Companion {
|
||||||
private constructor Companion()
|
private constructor Companion()
|
||||||
kotlin.platform.platformStatic() internal final fun a1(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun a1(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>@platformStatic fun a()<!>{
|
<!JVM_STATIC_NOT_IN_OBJECT!>@jvmStatic fun a()<!>{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -1,5 +1,5 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
open class B {
|
open class B {
|
||||||
public open val base1 : Int = 1
|
public open val base1 : Int = 1
|
||||||
@@ -9,38 +9,38 @@ open class B {
|
|||||||
class A {
|
class A {
|
||||||
companion object : B() {
|
companion object : B() {
|
||||||
var p1:Int = 1
|
var p1:Int = 1
|
||||||
@platformStatic set(p: Int) {
|
@jvmStatic set(p: Int) {
|
||||||
p1 = 1
|
p1 = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@platformStatic val z = 1;
|
@jvmStatic val z = 1;
|
||||||
|
|
||||||
@platformStatic override val base1: Int = 0
|
@jvmStatic override val base1: Int = 0
|
||||||
|
|
||||||
override val base2: Int = 0
|
override val base2: Int = 0
|
||||||
@platformStatic get
|
@jvmStatic get
|
||||||
}
|
}
|
||||||
|
|
||||||
object A : B() {
|
object A : B() {
|
||||||
var p:Int = 1
|
var p:Int = 1
|
||||||
@platformStatic set(p1: Int) {
|
@jvmStatic set(p1: Int) {
|
||||||
p = 1
|
p = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@platformStatic val z = 1;
|
@jvmStatic val z = 1;
|
||||||
|
|
||||||
<!OVERRIDE_CANNOT_BE_STATIC!>@platformStatic override val base1: Int<!> = 0
|
<!OVERRIDE_CANNOT_BE_STATIC!>@jvmStatic override val base1: Int<!> = 0
|
||||||
|
|
||||||
platformStatic open fun f() {}
|
jvmStatic open fun f() {}
|
||||||
|
|
||||||
override val base2: Int = 0
|
override val base2: Int = 0
|
||||||
<!OVERRIDE_CANNOT_BE_STATIC!>@platformStatic get<!>
|
<!OVERRIDE_CANNOT_BE_STATIC!>@jvmStatic get<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
var p:Int = 1
|
var p:Int = 1
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>@platformStatic set(p1: Int)<!> {
|
<!JVM_STATIC_NOT_IN_OBJECT!>@jvmStatic set(p1: Int)<!> {
|
||||||
p = 1
|
p = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
<!PLATFORM_STATIC_NOT_IN_OBJECT!>@platformStatic val z2<!> = 1;
|
<!JVM_STATIC_NOT_IN_OBJECT!>@jvmStatic val z2<!> = 1;
|
||||||
}
|
}
|
||||||
+6
-6
@@ -3,29 +3,29 @@ package
|
|||||||
internal final class A {
|
internal final class A {
|
||||||
public constructor A()
|
public constructor A()
|
||||||
internal final var p: kotlin.Int
|
internal final var p: kotlin.Int
|
||||||
kotlin.platform.platformStatic() internal final val z2: kotlin.Int = 1
|
kotlin.jvm.jvmStatic() internal final val z2: kotlin.Int = 1
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
internal object A : B {
|
internal object A : B {
|
||||||
private constructor A()
|
private constructor A()
|
||||||
kotlin.platform.platformStatic() public open override /*1*/ val base1: kotlin.Int = 0
|
kotlin.jvm.jvmStatic() public open override /*1*/ val base1: kotlin.Int = 0
|
||||||
public open override /*1*/ val base2: kotlin.Int = 0
|
public open override /*1*/ val base2: kotlin.Int = 0
|
||||||
internal final var p: kotlin.Int
|
internal final var p: kotlin.Int
|
||||||
kotlin.platform.platformStatic() internal final val z: kotlin.Int = 1
|
kotlin.jvm.jvmStatic() internal final val z: kotlin.Int = 1
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
kotlin.platform.platformStatic() internal open fun f(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal open fun f(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
public companion object Companion : B {
|
public companion object Companion : B {
|
||||||
private constructor Companion()
|
private constructor Companion()
|
||||||
kotlin.platform.platformStatic() public open override /*1*/ val base1: kotlin.Int = 0
|
kotlin.jvm.jvmStatic() public open override /*1*/ val base1: kotlin.Int = 0
|
||||||
public open override /*1*/ val base2: kotlin.Int = 0
|
public open override /*1*/ val base2: kotlin.Int = 0
|
||||||
internal final var p1: kotlin.Int
|
internal final var p1: kotlin.Int
|
||||||
kotlin.platform.platformStatic() internal final val z: kotlin.Int = 1
|
kotlin.jvm.jvmStatic() internal final val z: kotlin.Int = 1
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
open class Base {
|
open class Base {
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
@@ -6,6 +6,6 @@ open class Base {
|
|||||||
|
|
||||||
class Derived : Base() {
|
class Derived : Base() {
|
||||||
companion object {
|
companion object {
|
||||||
<!ACCIDENTAL_OVERRIDE!>platformStatic fun foo()<!> {}
|
<!ACCIDENTAL_OVERRIDE!>jvmStatic fun foo()<!> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ internal final class Derived : Base {
|
|||||||
public companion object Companion {
|
public companion object Companion {
|
||||||
private constructor Companion()
|
private constructor Companion()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
kotlin.platform.platformStatic() internal final fun foo(): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun foo(): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
open class Base {
|
open class Base {
|
||||||
fun `foo$default`(i: Int, mask: Int) {}
|
fun `foo$default`(i: Int, mask: Int) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Derived : Base() {
|
object Derived : Base() {
|
||||||
<!ACCIDENTAL_OVERRIDE!>platformStatic fun foo(i: Int = 0)<!> {}
|
<!ACCIDENTAL_OVERRIDE!>jvmStatic fun foo(i: Int = 0)<!> {}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ internal open class Base {
|
|||||||
internal object Derived : Base {
|
internal object Derived : Base {
|
||||||
private constructor Derived()
|
private constructor Derived()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
kotlin.platform.platformStatic() internal final fun foo(/*0*/ i: kotlin.Int = ...): kotlin.Unit
|
kotlin.jvm.jvmStatic() internal final fun foo(/*0*/ i: kotlin.Int = ...): kotlin.Unit
|
||||||
internal final override /*1*/ /*fake_override*/ fun `foo$default`(/*0*/ i: kotlin.Int, /*1*/ mask: kotlin.Int): kotlin.Unit
|
internal final override /*1*/ /*fake_override*/ fun `foo$default`(/*0*/ i: kotlin.Int, /*1*/ mask: kotlin.Int): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
@@ -66,7 +66,11 @@ open class KFunctionImpl protected constructor(
|
|||||||
is Constructor<*> -> FunctionCaller.Constructor(member)
|
is Constructor<*> -> FunctionCaller.Constructor(member)
|
||||||
is Method -> when {
|
is Method -> when {
|
||||||
!Modifier.isStatic(member.modifiers) -> FunctionCaller.InstanceMethod(member)
|
!Modifier.isStatic(member.modifiers) -> FunctionCaller.InstanceMethod(member)
|
||||||
descriptor.annotations.findAnnotation(PLATFORM_STATIC) != null -> FunctionCaller.PlatformStaticInObject(member)
|
|
||||||
|
descriptor.annotations.findAnnotation(PLATFORM_STATIC) != null,
|
||||||
|
descriptor.annotations.findAnnotation(JVM_STATIC) != null->
|
||||||
|
FunctionCaller.PlatformStaticInObject(member)
|
||||||
|
|
||||||
else -> FunctionCaller.StaticMethod(member)
|
else -> FunctionCaller.StaticMethod(member)
|
||||||
}
|
}
|
||||||
else -> throw KotlinReflectionInternalError("Call is not yet supported for this function: $descriptor")
|
else -> throw KotlinReflectionInternalError("Call is not yet supported for this function: $descriptor")
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ interface KMutablePropertyImpl<R> : KMutableProperty<R>, KPropertyImpl<R> {
|
|||||||
|
|
||||||
private fun KPropertyImpl.Accessor<*>.computeCallerForAccessor(isGetter: Boolean): FunctionCaller<*> {
|
private fun KPropertyImpl.Accessor<*>.computeCallerForAccessor(isGetter: Boolean): FunctionCaller<*> {
|
||||||
fun isPlatformStaticProperty() =
|
fun isPlatformStaticProperty() =
|
||||||
property.descriptor.annotations.findAnnotation(PLATFORM_STATIC) != null
|
property.descriptor.annotations.findAnnotation(PLATFORM_STATIC) != null ||
|
||||||
|
property.descriptor.annotations.findAnnotation(JVM_STATIC) != null
|
||||||
|
|
||||||
fun isNotNullProperty() =
|
fun isNotNullProperty() =
|
||||||
!TypeUtils.isNullableType(property.descriptor.type)
|
!TypeUtils.isNullableType(property.descriptor.type)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.name.FqName
|
|||||||
import kotlin.reflect.IllegalCallableAccessException
|
import kotlin.reflect.IllegalCallableAccessException
|
||||||
|
|
||||||
internal val PLATFORM_STATIC = FqName("kotlin.platform.platformStatic")
|
internal val PLATFORM_STATIC = FqName("kotlin.platform.platformStatic")
|
||||||
|
internal val JVM_STATIC = FqName("kotlin.jvm.jvmStatic")
|
||||||
|
|
||||||
// TODO: wrap other exceptions
|
// TODO: wrap other exceptions
|
||||||
internal inline fun <R> reflectionCall(block: () -> R): R =
|
internal inline fun <R> reflectionCall(block: () -> R): R =
|
||||||
|
|||||||
+3
-3
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.idea.refactoring.safeDelete.removeOverrideModifier
|
|||||||
import org.jetbrains.kotlin.lexer.JetTokens
|
import org.jetbrains.kotlin.lexer.JetTokens
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import java.util.HashMap
|
import java.util.*
|
||||||
|
|
||||||
public class JavaToKotlinPreconversionPullUpHelper(
|
public class JavaToKotlinPreconversionPullUpHelper(
|
||||||
private val data: PullUpData,
|
private val data: PullUpData,
|
||||||
@@ -58,7 +58,7 @@ public class JavaToKotlinPreconversionPullUpHelper(
|
|||||||
private val fieldsToUsages = HashMap<PsiField, List<EncapsulateFieldUsageInfo>>()
|
private val fieldsToUsages = HashMap<PsiField, List<EncapsulateFieldUsageInfo>>()
|
||||||
private val dummyAccessorByName = HashMap<String, PsiMethod>()
|
private val dummyAccessorByName = HashMap<String, PsiMethod>()
|
||||||
|
|
||||||
private val platformStaticAnnotation = JetPsiFactory(data.sourceClass.project).createAnnotationEntry("kotlin.platform.platformStatic")
|
private val jvmStaticAnnotation = JetPsiFactory(data.sourceClass.project).createAnnotationEntry("kotlin.jvm.jvmStatic")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private var PsiMember.originalMember: PsiMember? by CopyableUserDataProperty(Key.create("ORIGINAL_MEMBER"))
|
private var PsiMember.originalMember: PsiMember? by CopyableUserDataProperty(Key.create("ORIGINAL_MEMBER"))
|
||||||
@@ -147,7 +147,7 @@ public class JavaToKotlinPreconversionPullUpHelper(
|
|||||||
newDeclaration.removeModifier(JetTokens.ABSTRACT_KEYWORD)
|
newDeclaration.removeModifier(JetTokens.ABSTRACT_KEYWORD)
|
||||||
}
|
}
|
||||||
if (member.hasModifierProperty(PsiModifier.STATIC) && newDeclaration is JetNamedFunction) {
|
if (member.hasModifierProperty(PsiModifier.STATIC) && newDeclaration is JetNamedFunction) {
|
||||||
newDeclaration.addAnnotationWithSpace(platformStaticAnnotation).addToShorteningWaitSet()
|
newDeclaration.addAnnotationWithSpace(jvmStaticAnnotation).addToShorteningWaitSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (originalMember is PsiField) {
|
if (originalMember is PsiField) {
|
||||||
|
|||||||
+13
-13
@@ -1,57 +1,57 @@
|
|||||||
import kotlin.platform.platformStatic
|
import kotlin.jvm.jvmStatic
|
||||||
|
|
||||||
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'class'">platformStatic</error>
|
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'class'">jvmStatic</error>
|
||||||
class A {
|
class A {
|
||||||
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'object'">platformStatic</error>
|
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'object'">jvmStatic</error>
|
||||||
companion object {
|
companion object {
|
||||||
platformStatic fun a1() {
|
jvmStatic fun a1() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'object'">platformStatic</error>
|
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'object'">jvmStatic</error>
|
||||||
object A {
|
object A {
|
||||||
platformStatic fun a2() {
|
jvmStatic fun a2() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
|
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
|
||||||
<error descr="[PLATFORM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'">platformStatic fun a3()</error> {
|
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'">jvmStatic fun a3()</error> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<error descr="[PLATFORM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'">platformStatic fun a4()</error> {
|
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'">jvmStatic fun a4()</error> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'interface'">platformStatic</error>
|
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'interface'">jvmStatic</error>
|
||||||
interface B {
|
interface B {
|
||||||
companion object {
|
companion object {
|
||||||
<error descr="[PLATFORM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'">platformStatic fun a1()</error> {
|
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'">jvmStatic fun a1()</error> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
platformStatic fun a2() {
|
jvmStatic fun a2() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
|
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
|
||||||
<error descr="[PLATFORM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'">platformStatic fun a3()</error> {
|
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'">jvmStatic fun a3()</error> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<error descr="[PLATFORM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'">platformStatic fun a4()</error> {
|
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with 'jvmStatic'">jvmStatic fun a4()</error> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package to
|
package to
|
||||||
|
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object JavaClass {
|
public object JavaClass {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
println("Hello, world!")
|
println("Hello, world!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
abstract class A {
|
abstract class A {
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
var x = 2 * 3
|
var x = 2 * 3
|
||||||
@@ -23,7 +21,7 @@ abstract class A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
platformStatic fun foo2(n: Int): String {
|
jvmStatic fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,3 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
abstract class A {
|
abstract class A {
|
||||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||||
var x = 2 * 3
|
var x = 2 * 3
|
||||||
@@ -21,7 +19,7 @@ abstract class A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||||
platformStatic fun foo2(n: Int): String {
|
jvmStatic fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
class Y
|
class Y
|
||||||
@@ -17,7 +15,7 @@ interface A {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
platformStatic fun foo2(n: Int): String {
|
jvmStatic fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
class T {
|
class T {
|
||||||
class U {
|
class U {
|
||||||
abstract class A {
|
abstract class A {
|
||||||
@@ -25,7 +23,7 @@ class T {
|
|||||||
var X = "1" + "2"
|
var X = "1" + "2"
|
||||||
|
|
||||||
// INFO: {"checked": "true"}
|
// INFO: {"checked": "true"}
|
||||||
platformStatic fun foo2(n: Int): String {
|
jvmStatic fun foo2(n: Int): String {
|
||||||
return "_" + n + "_"
|
return "_" + n + "_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ import org.jetbrains.kotlin.j2k.usageProcessing.UsageProcessing
|
|||||||
import org.jetbrains.kotlin.j2k.usageProcessing.UsageProcessingExpressionConverter
|
import org.jetbrains.kotlin.j2k.usageProcessing.UsageProcessingExpressionConverter
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions.*
|
import org.jetbrains.kotlin.types.expressions.OperatorConventions.*
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
import java.util.HashMap
|
|
||||||
|
|
||||||
class Converter private constructor(
|
class Converter private constructor(
|
||||||
private val elementToConvert: PsiElement,
|
private val elementToConvert: PsiElement,
|
||||||
@@ -424,7 +423,7 @@ class Converter private constructor(
|
|||||||
if (function == null) return null
|
if (function == null) return null
|
||||||
|
|
||||||
if (PsiMethodUtil.isMainMethod(method)) {
|
if (PsiMethodUtil.isMainMethod(method)) {
|
||||||
val fqName = FqName("kotlin.platform.platformStatic")
|
val fqName = FqName("kotlin.jvm.jvmStatic")
|
||||||
val identifier = Identifier(fqName.shortName().identifier, imports = listOf(fqName)).assignNoPrototype()
|
val identifier = Identifier(fqName.shortName().identifier, imports = listOf(fqName)).assignNoPrototype()
|
||||||
|
|
||||||
function.annotations += Annotations(
|
function.annotations += Annotations(
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object A {
|
public object A {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
println(Void.TYPE)
|
println(Void.TYPE)
|
||||||
println(Integer.TYPE)
|
println(Integer.TYPE)
|
||||||
println(java.lang.Double.TYPE)
|
println(java.lang.Double.TYPE)
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object TestClass {
|
public object TestClass {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i < 10) {
|
while (i < 10) {
|
||||||
if (i == 4 || i == 8) {
|
if (i == 4 || i == 8) {
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object TestClass {
|
public object TestClass {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
var i = 0
|
var i = 0
|
||||||
var j = 1
|
var j = 1
|
||||||
while (i < 10) {
|
while (i < 10) {
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object TestClass {
|
public object TestClass {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
var i = 1
|
var i = 1
|
||||||
while (i < 1000) {
|
while (i < 1000) {
|
||||||
if (i == 4 || i == 8) {
|
if (i == 4 || i == 8) {
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object TestClass {
|
public object TestClass {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
var i = 1
|
var i = 1
|
||||||
OuterLoop1@ OuterLoop2@ while (i < 1000) {
|
OuterLoop1@ OuterLoop2@ while (i < 1000) {
|
||||||
var j = 1
|
var j = 1
|
||||||
|
|||||||
+1
-4
@@ -1,5 +1,2 @@
|
|||||||
import kotlin.platform.platformStatic
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
|
||||||
platformStatic public fun main(args: Array<String>) {
|
|
||||||
}
|
}
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object A {
|
public object A {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
// !forceNotNullTypes: false
|
// !forceNotNullTypes: false
|
||||||
public object A {
|
public object A {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
// ERROR: Property must be initialized or be abstract
|
// ERROR: Property must be initialized or be abstract
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public class Identifier<T> {
|
public class Identifier<T> {
|
||||||
public val name: T
|
public val name: T
|
||||||
private val myHasDollar: Boolean
|
private val myHasDollar: Boolean
|
||||||
@@ -23,7 +21,7 @@ public class Identifier<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public object User {
|
public object User {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
val i1 = Identifier("name", false, true)
|
val i1 = Identifier("name", false, true)
|
||||||
val i2 = Identifier("name", false)
|
val i2 = Identifier("name", false)
|
||||||
val i3 = Identifier("name")
|
val i3 = Identifier("name")
|
||||||
|
|||||||
+1
-2
@@ -3,10 +3,9 @@
|
|||||||
// ERROR: Assignments are not expressions, and only expressions are allowed in this context
|
// ERROR: Assignments are not expressions, and only expressions are allowed in this context
|
||||||
// ERROR: Unresolved reference: close
|
// ERROR: Unresolved reference: close
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
object FileRead {
|
object FileRead {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
try {
|
try {
|
||||||
val fstream = FileInputStream()
|
val fstream = FileInputStream()
|
||||||
val `in` = DataInputStream(fstream)
|
val `in` = DataInputStream(fstream)
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
package demo
|
package demo
|
||||||
|
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
object Program {
|
object Program {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
println("Halo!")
|
println("Halo!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
package demo
|
package demo
|
||||||
|
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object SwitchDemo {
|
public object SwitchDemo {
|
||||||
public fun print(o: Any) {
|
public fun print(o: Any) {
|
||||||
println(o)
|
println(o)
|
||||||
@@ -78,7 +76,7 @@ public object SwitchDemo {
|
|||||||
println(monthString)
|
println(monthString)
|
||||||
}
|
}
|
||||||
|
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
for (i in 1..12)
|
for (i in 1..12)
|
||||||
test(i)
|
test(i)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object NonDefault {
|
public object NonDefault {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
|
|
||||||
val value = 3
|
val value = 3
|
||||||
val valueString = ""
|
val valueString = ""
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
package switch_demo
|
package switch_demo
|
||||||
|
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object SwitchDemo {
|
public object SwitchDemo {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
val month = 8
|
val month = 8
|
||||||
val monthString: String
|
val monthString: String
|
||||||
when (month) {
|
when (month) {
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object C {
|
public object C {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
when (args.size()) {
|
when (args.size()) {
|
||||||
1 -> {
|
1 -> {
|
||||||
run {
|
run {
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
package switch_demo
|
package switch_demo
|
||||||
|
|
||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object SwitchDemo {
|
public object SwitchDemo {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
|
|
||||||
val month = 8
|
val month = 8
|
||||||
val monthString: String
|
val monthString: String
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
import kotlin.platform.platformStatic
|
|
||||||
|
|
||||||
public object NonDefault {
|
public object NonDefault {
|
||||||
platformStatic public fun main(args: Array<String>) {
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
|
|
||||||
val value = 3
|
val value = 3
|
||||||
var valueString = ""
|
var valueString = ""
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ package kotlin.jvm
|
|||||||
target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
|
||||||
public annotation(retention = AnnotationRetention.BINARY, mustBeDocumented = true) class jvmOverloads
|
public annotation(retention = AnnotationRetention.BINARY, mustBeDocumented = true) class jvmOverloads
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that a static method or field needs to be generated from this element.
|
||||||
|
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#static-methods-and-fields)
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||||
|
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class jvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instructs the Kotlin compiler to generate a public backing field for this property.
|
* Instructs the Kotlin compiler to generate a public backing field for this property.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ import kotlin.annotation.AnnotationTarget.*
|
|||||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformName(public val name: String)
|
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformName(public val name: String)
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies that a static method or field needs to be generated from this element.
|
|
||||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#static-methods-and-fields)
|
|
||||||
* for more information.
|
|
||||||
*/
|
|
||||||
target(FUNCTION, PROPERTY, FIELD, PROPERTY_GETTER, PROPERTY_SETTER)
|
target(FUNCTION, PROPERTY, FIELD, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||||
|
deprecated("Use kotlin.jvm.jvmStatic instead", ReplaceWith("kotlin.jvm.jvmStatic"))
|
||||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformStatic
|
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformStatic
|
||||||
|
|||||||
Reference in New Issue
Block a user