Deprecate some of JVM flag annotations in favor of capitilized themselves
This commit is contained in:
@@ -60,13 +60,13 @@ public abstract class AnnotationCodegen {
|
||||
}
|
||||
|
||||
public static final List<JvmFlagAnnotation> FIELD_FLAGS = Arrays.asList(
|
||||
new JvmFlagAnnotation("kotlin.jvm.volatile", Opcodes.ACC_VOLATILE),
|
||||
new JvmFlagAnnotation("kotlin.jvm.transient", Opcodes.ACC_TRANSIENT)
|
||||
new JvmFlagAnnotation("kotlin.jvm.Volatile", Opcodes.ACC_VOLATILE),
|
||||
new JvmFlagAnnotation("kotlin.jvm.Transient", Opcodes.ACC_TRANSIENT)
|
||||
);
|
||||
|
||||
public static final List<JvmFlagAnnotation> METHOD_FLAGS = Arrays.asList(
|
||||
new JvmFlagAnnotation("kotlin.jvm.strictfp", Opcodes.ACC_STRICT),
|
||||
new JvmFlagAnnotation("kotlin.jvm.synchronized", Opcodes.ACC_SYNCHRONIZED),
|
||||
new JvmFlagAnnotation("kotlin.jvm.Strictfp", Opcodes.ACC_STRICT),
|
||||
new JvmFlagAnnotation("kotlin.jvm.Synchronized", Opcodes.ACC_SYNCHRONIZED),
|
||||
new JvmFlagAnnotation("kotlin.jvm.native", Opcodes.ACC_NATIVE)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import java.lang.reflect.Modifier
|
||||
|
||||
class C {
|
||||
volatile var vol = 1
|
||||
transient val tra = 1
|
||||
@Volatile var vol = 1
|
||||
@Transient val tra = 1
|
||||
|
||||
strictfp fun str() {}
|
||||
synchronized fun sync() {}
|
||||
@Strictfp fun str() {}
|
||||
@Synchronized fun sync() {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
volatile var vol = 1
|
||||
transient val tra = 1
|
||||
@Volatile var vol = 1
|
||||
@Transient val tra = 1
|
||||
|
||||
strictfp fun str() {}
|
||||
synchronized fun sync() {}
|
||||
@Strictfp fun str() {}
|
||||
@Synchronized fun sync() {}
|
||||
|
||||
// 0 kotlin/jvm/volatile
|
||||
// 0 kotlin/jvm/transient
|
||||
// 0 kotlin/jvm/strictfp
|
||||
// 0 kotlin/jvm/synchronized
|
||||
// 0 kotlin/jvm/Volatile
|
||||
// 0 kotlin/jvm/Transient
|
||||
// 0 kotlin/jvm/Strictfp
|
||||
// 0 kotlin/jvm/Synchronized
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@file:[volatile]
|
||||
@file:[Volatile]
|
||||
/**
|
||||
* Doc comment
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ JetFile: DocCommentAfterFileAnnotations.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
@file:[volatile]
|
||||
@file:[Volatile]
|
||||
// class C
|
||||
class C{}
|
||||
@@ -11,7 +11,7 @@ JetFile: LineCommentAfterFileAnnotations.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
|
||||
@@ -16,7 +16,7 @@ private @ @[Ann1(1)] Ann3("2") class A(
|
||||
@[Ann]
|
||||
private
|
||||
@
|
||||
@volatile var x = 1
|
||||
@Volatile var x = 1
|
||||
|
||||
foo(fun(@ @ann(1) x: Int) {})
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ JetFile: declarationsJustAtTyped.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private @open @[Ann1(1)] @Ann2("1") Ann3("2") class A(
|
||||
@volatile(1) private val x: @AnnType("3") @open Int,
|
||||
@Volatile(1) private val x: @AnnType("3") @open Int,
|
||||
@private var y: Int,
|
||||
@open z: Int
|
||||
) {
|
||||
@@ -16,7 +16,7 @@ private @open @[Ann1(1)] @Ann2("1") Ann3("2") class A(
|
||||
@[Ann]
|
||||
private
|
||||
@abstract
|
||||
@volatile var x = 1
|
||||
@Volatile var x = 1
|
||||
|
||||
foo(fun(@vararg @ann(1) x: Int) {})
|
||||
}
|
||||
@@ -43,5 +43,5 @@ private @open @[Ann1(1)] @Ann2("1") Ann3("2") class A(
|
||||
|
||||
fun bar() {
|
||||
try {}
|
||||
catch (@volatile e: Exception) {}
|
||||
catch (@Volatile e: Exception) {}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ JetFile: validDeclarations.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -292,7 +292,7 @@ JetFile: validDeclarations.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -570,7 +570,7 @@ JetFile: validDeclarations.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('e')
|
||||
PsiElement(COLON)(':')
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
fun foo() {
|
||||
for (@volatile x in z) {}
|
||||
for (@Volatile x in z) {}
|
||||
|
||||
for (@[ann]) {}
|
||||
for (@ in z) {}
|
||||
@@ -8,14 +8,14 @@ fun foo() {
|
||||
|
||||
for ((@[ann], x) in pair) {}
|
||||
|
||||
for (volatile x in 1..100) {}
|
||||
for (volatile(1) x in 1..100) {}
|
||||
for (volatile() (x, volatile y) in 1..100) {}
|
||||
for (volatile (x, volatile y) in 1..100) {}
|
||||
for (Volatile x in 1..100) {}
|
||||
for (Volatile(1) x in 1..100) {}
|
||||
for (Volatile() (x, Volatile y) in 1..100) {}
|
||||
for (Volatile (x, Volatile y) in 1..100) {}
|
||||
|
||||
for (volatile var x in 1..100) {}
|
||||
for (volatile val (x, volatile y) in 1..100) {}
|
||||
for (Volatile var x in 1..100) {}
|
||||
for (Volatile val (x, Volatile y) in 1..100) {}
|
||||
|
||||
for (private volatile var x in 1..100) {}
|
||||
for (private volatile val (x, volatile y) in 1..100) {}
|
||||
for (private Volatile var x in 1..100) {}
|
||||
for (private Volatile val (x, Volatile y) in 1..100) {}
|
||||
}
|
||||
|
||||
+13
-13
@@ -26,7 +26,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -199,7 +199,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -231,7 +231,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -269,7 +269,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -286,7 +286,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('y')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -319,7 +319,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
MULTI_VARIABLE_DECLARATION_ENTRY
|
||||
@@ -333,7 +333,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('y')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -366,7 +366,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -400,7 +400,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -416,7 +416,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('y')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -451,7 +451,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -487,7 +487,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -503,7 +503,7 @@ JetFile: forParameters.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('y')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
+2
-2
@@ -2,6 +2,6 @@ fun foo() {
|
||||
val (x, private data @ann @[ann] y) = pair
|
||||
val (@[ann], x) = pair
|
||||
|
||||
@volatile val (@ann x, y) = 1
|
||||
@volatile val (@ann x, y = 1
|
||||
@Volatile val (@ann x, y) = 1
|
||||
@Volatile val (@ann x, y = 1
|
||||
}
|
||||
|
||||
+2
-2
@@ -97,7 +97,7 @@ JetFile: multiDeclaration.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -132,7 +132,7 @@ JetFile: multiDeclaration.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('volatile')
|
||||
PsiElement(IDENTIFIER)('Volatile')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package to
|
||||
|
||||
volatile var field = 1
|
||||
Volatile var field = 1
|
||||
@@ -90,10 +90,10 @@ class AnnotationConverter(private val converter: Converter) {
|
||||
}
|
||||
|
||||
private val MODIFIER_TO_ANNOTATION = listOf(
|
||||
PsiModifier.SYNCHRONIZED to "synchronized",
|
||||
PsiModifier.VOLATILE to "volatile",
|
||||
PsiModifier.STRICTFP to "strictfp",
|
||||
PsiModifier.TRANSIENT to "transient"
|
||||
PsiModifier.SYNCHRONIZED to "Synchronized",
|
||||
PsiModifier.VOLATILE to "Volatile",
|
||||
PsiModifier.STRICTFP to "Strictfp",
|
||||
PsiModifier.TRANSIENT to "Transient"
|
||||
)
|
||||
|
||||
private fun mapTargetByName(expr: PsiReferenceExpression): Set<KotlinTarget> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class A {
|
||||
deprecated("")
|
||||
volatile var field1 = 0
|
||||
Volatile var field1 = 0
|
||||
|
||||
transient var field2 = 1
|
||||
Transient var field2 = 1
|
||||
|
||||
strictfp var field3 = 2.0
|
||||
Strictfp var field3 = 2.0
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
synchronized fun foo() {
|
||||
Synchronized fun foo() {
|
||||
bar()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ class A {
|
||||
println("p = [$p]")
|
||||
}
|
||||
|
||||
synchronized public fun foo() {
|
||||
Synchronized public fun foo() {
|
||||
foo(calcSomething())
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ import kotlin.annotation.AnnotationTarget.*
|
||||
* are immediately made visible to other threads.
|
||||
*/
|
||||
target(FIELD)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class volatile
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Volatile
|
||||
|
||||
/**
|
||||
* Marks the JVM backing field of the annotated property as `transient`, meaning that it is not
|
||||
* part of the default serialized form of the object.
|
||||
*/
|
||||
target(FIELD)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class transient
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Transient
|
||||
|
||||
/**
|
||||
* Marks the JVM method generated from the annotated function as `strictfp`, meaning that the precision
|
||||
@@ -38,7 +38,7 @@ public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = tru
|
||||
* achieve better portability.
|
||||
*/
|
||||
target(FUNCTION, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER, CLASSIFIER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class strictfp
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Strictfp
|
||||
|
||||
/**
|
||||
* Marks the JVM method generated from the annotated function as `synchronized`, meaning that the method
|
||||
@@ -46,7 +46,7 @@ public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = tru
|
||||
* for static methods, the class) on which the method is defined.
|
||||
*/
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class synchronized
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Synchronized
|
||||
|
||||
/**
|
||||
* Marks the JVM method generated from the annotated function as `native`, meaning that it's not implemented
|
||||
|
||||
Reference in New Issue
Block a user