Introduced IDEAPluginsCompatibilityAPI and returned some API
Please read the description of IDEAPluginsCompatibilityAPI. Also, you may notice, that Deprecation annotation was removed. That is because with level ERROR it isn't possible to opt-in to such API in the legit cases. And with level WARNING it won't be reported because We have diagnostic with level ERROR about OptIn marker. Sadly, there is no way to add ReplaceWith to the OptIn marker
This commit is contained in:
+10
@@ -10,6 +10,8 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.WARNING
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.utils.IDEAPlatforms
|
||||
import org.jetbrains.kotlin.utils.IDEAPluginsCompatibilityAPI
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
@@ -149,6 +151,14 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var readDeserializedContracts: Boolean by FreezableVar(false)
|
||||
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._212, // maybe 211 AS used it too
|
||||
IDEAPlatforms._213,
|
||||
message = "Please migrate to -opt-in",
|
||||
plugins = "Android"
|
||||
)
|
||||
var experimental: Array<String>? = null
|
||||
|
||||
@Argument(
|
||||
value = "-Xuse-experimental",
|
||||
valueDescription = "<fq.name>",
|
||||
|
||||
@@ -17,59 +17,58 @@ import org.jetbrains.kotlin.resolve.calls.util.getCalleeExpressionIfAny
|
||||
import org.jetbrains.kotlin.resolve.calls.util.createLookupLocation
|
||||
import org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.IDEAPlatforms
|
||||
import org.jetbrains.kotlin.utils.IDEAPluginsCompatibilityAPI
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getResolvedCall instead.",
|
||||
ReplaceWith("getResolvedCall", "org.jetbrains.kotlin.resolve.calls.util.getResolvedCall"),
|
||||
level = DeprecationLevel.ERROR
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._213, // I'm not sure about 212 and 211 AS -- didn't check them
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getResolvedCall instead.",
|
||||
plugins = "Android in IDEA"
|
||||
)
|
||||
fun Call?.getResolvedCall(context: BindingContext): ResolvedCall<out CallableDescriptor>? = getResolvedCall(context)
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getResolvedCall instead.",
|
||||
ReplaceWith("getResolvedCall", "org.jetbrains.kotlin.resolve.calls.util.getResolvedCall"),
|
||||
level = DeprecationLevel.ERROR
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._213, // I'm not sure about 212 and 211 AS -- didn't check them
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getResolvedCall instead.",
|
||||
plugins = "Android in IDEA"
|
||||
)
|
||||
fun KtElement?.getResolvedCall(context: BindingContext): ResolvedCall<out CallableDescriptor>? = getResolvedCall(context)
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getType instead.",
|
||||
ReplaceWith("getType", "org.jetbrains.kotlin.resolve.calls.util.getType"),
|
||||
level = DeprecationLevel.ERROR
|
||||
|
||||
// TODO: find what IDEA's used it
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getType instead."
|
||||
)
|
||||
fun KtExpression.getType(context: BindingContext): KotlinType? = getType(context)
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getCall instead.",
|
||||
ReplaceWith("getType", "org.jetbrains.kotlin.resolve.calls.util.getCall"),
|
||||
level = DeprecationLevel.ERROR
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._213, // I'm not sure about 212 and 211 AS -- didn't check them
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getCall instead.",
|
||||
plugins = "Android in IDEA"
|
||||
)
|
||||
fun KtElement.getCall(context: BindingContext): Call? = getCall(context)
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getCalleeExpressionIfAny instead.",
|
||||
ReplaceWith("getCalleeExpressionIfAny", "org.jetbrains.kotlin.resolve.calls.util.getCalleeExpressionIfAny"),
|
||||
level = DeprecationLevel.ERROR
|
||||
// TODO: find what IDEA's used it
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getCalleeExpressionIfAny instead."
|
||||
)
|
||||
fun KtElement?.getCalleeExpressionIfAny(): KtExpression? = getCalleeExpressionIfAny()
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.createLookupLocation instead.",
|
||||
ReplaceWith("createLookupLocation", "org.jetbrains.kotlin.resolve.calls.util.createLookupLocation"),
|
||||
level = DeprecationLevel.ERROR
|
||||
// TODO: find what IDEA's used it
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.createLookupLocation instead."
|
||||
)
|
||||
fun Call.createLookupLocation(): KotlinLookupLocation = createLookupLocation()
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.createLookupLocation instead.",
|
||||
ReplaceWith("createLookupLocation", "org.jetbrains.kotlin.resolve.calls.util.createLookupLocation"),
|
||||
level = DeprecationLevel.ERROR
|
||||
// TODO: find what IDEA's used it
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.createLookupLocation instead."
|
||||
)
|
||||
fun KtExpression.createLookupLocation(): KotlinLookupLocation? = createLookupLocation()
|
||||
|
||||
@Deprecated(
|
||||
"Use org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression instead.",
|
||||
ReplaceWith("getValueArgumentForExpression", "org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression"),
|
||||
level = DeprecationLevel.ERROR
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._213, // I'm not sure about 212 and 211 AS -- didn't check them
|
||||
message = "Use org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression instead.",
|
||||
plugins = "Android in IDEA"
|
||||
)
|
||||
fun Call.getValueArgumentForExpression(expression: KtExpression): ValueArgument? = getValueArgumentForExpression(expression)
|
||||
|
||||
Reference in New Issue
Block a user