Return some API and mark them as IDEAPluginsCompatibilityAPI
This commit is contained in:
+9
-9
@@ -94,10 +94,10 @@ public class DefaultErrorMessages {
|
||||
MAP.put(EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE,
|
||||
"Extension function is shadowed by a member property ''{0}'' with {1}", NAME, COMPACT_WITH_MODIFIERS);
|
||||
|
||||
MAP.put(INACCESSIBLE_TYPE, "Type {0} is inaccessible in this context due to: {1}", RENDER_TYPE, commaSeparated(
|
||||
MAP.put(INACCESSIBLE_TYPE, "Type {0} is inaccessible in this context due to: {1}", RENDER_TYPE, CommonRenderers.commaSeparated(
|
||||
FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS));
|
||||
|
||||
MAP.put(REDECLARATION, "Conflicting declarations: {0}", commaSeparated(COMPACT_WITH_MODIFIERS));
|
||||
MAP.put(REDECLARATION, "Conflicting declarations: {0}", CommonRenderers.commaSeparated(COMPACT_WITH_MODIFIERS));
|
||||
MAP.put(PACKAGE_OR_CLASSIFIER_REDECLARATION, "Redeclaration: {0}", STRING);
|
||||
MAP.put(DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE, "Duplicate parameter name in function type");
|
||||
|
||||
@@ -315,9 +315,9 @@ public class DefaultErrorMessages {
|
||||
MODULE_WITH_PLATFORM, adaptGenerics1(PlatformIncompatibilityDiagnosticRenderer.TEXT));
|
||||
MAP.put(ACTUAL_WITHOUT_EXPECT, "{0} has no corresponding expected declaration{1}", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM,
|
||||
adaptGenerics1(PlatformIncompatibilityDiagnosticRenderer.TEXT));
|
||||
MAP.put(AMBIGUOUS_ACTUALS, "{0} has several compatible actual declarations in modules {1}", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM, commaSeparated(
|
||||
MAP.put(AMBIGUOUS_ACTUALS, "{0} has several compatible actual declarations in modules {1}", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM, CommonRenderers.commaSeparated(
|
||||
MODULE));
|
||||
MAP.put(AMBIGUOUS_EXPECTS, "{0} has several compatible expect declarations in modules {1}", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM, commaSeparated(
|
||||
MAP.put(AMBIGUOUS_EXPECTS, "{0} has several compatible expect declarations in modules {1}", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM, CommonRenderers.commaSeparated(
|
||||
MODULE));
|
||||
|
||||
MAP.put(NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS, "Actual class ''{0}'' has no corresponding members for expected class members:{1}",
|
||||
@@ -438,7 +438,7 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(DELEGATION_IN_INTERFACE, "Interfaces cannot use delegation");
|
||||
MAP.put(DELEGATION_NOT_TO_INTERFACE, "Only interfaces can be delegated to");
|
||||
MAP.put(DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, "Delegated member ''{0}'' hides supertype override: {1}. Please specify proper override explicitly", COMPACT, commaSeparated(SHORT_NAMES_IN_TYPES));
|
||||
MAP.put(DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, "Delegated member ''{0}'' hides supertype override: {1}. Please specify proper override explicitly", COMPACT, CommonRenderers.commaSeparated(SHORT_NAMES_IN_TYPES));
|
||||
MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor");
|
||||
MAP.put(NO_CONSTRUCTOR_WARNING, "This class does not have a constructor. This warning will be an error in future releases");
|
||||
MAP.put(RESOLUTION_TO_CLASSIFIER, "{2}", NAME, TO_STRING, STRING);
|
||||
@@ -882,7 +882,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", FQ_NAMES_IN_TYPES,
|
||||
FQ_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(CONFLICTING_INHERITED_MEMBERS, "{0} inherits conflicting members: {1}", NAME, commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(CONFLICTING_INHERITED_MEMBERS, "{0} inherits conflicting members: {1}", NAME, CommonRenderers.commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED, "{0} is not abstract and does not implement abstract member {1}", RENDER_CLASS_OR_OBJECT,
|
||||
FQ_NAMES_IN_TYPES);
|
||||
MAP.put(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED, "{0} is not abstract and does not implement abstract base class member {1}",
|
||||
@@ -896,9 +896,9 @@ public class DefaultErrorMessages {
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
MAP.put(MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED_WARNING, "Deprecated: {0} must override {1} because it inherits multiple interface methods of it",
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
MAP.put(INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER, "{0} inherits invisible abstract members: {1}", NAME, commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER, "{0} inherits invisible abstract members: {1}", NAME, CommonRenderers.commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
|
||||
MAP.put(CONFLICTING_OVERLOADS, "Conflicting overloads: {0}", commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(CONFLICTING_OVERLOADS, "Conflicting overloads: {0}", CommonRenderers.commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
|
||||
MAP.put(FUNCTION_EXPECTED, "Expression ''{0}''{1} cannot be invoked as a function. " +
|
||||
"The function ''" + OperatorNameConventions.INVOKE.asString() + "()'' is not found",
|
||||
@@ -1032,7 +1032,7 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES,
|
||||
"Names of the parameter #{1} conflict in the following members of supertypes: ''{0}''. " +
|
||||
"This may cause problems when calling this function with named arguments.", commaSeparated(
|
||||
"This may cause problems when calling this function with named arguments.", CommonRenderers.commaSeparated(
|
||||
FQ_NAMES_IN_TYPES), TO_STRING);
|
||||
|
||||
MAP.put(NAME_FOR_AMBIGUOUS_PARAMETER, "Named argument is not allowed for a parameter with an ambiguous name");
|
||||
|
||||
@@ -46,6 +46,8 @@ import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.getValidi
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.utils.IDEAPlatforms
|
||||
import org.jetbrains.kotlin.utils.IDEAPluginsCompatibilityAPI
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
@@ -196,6 +198,15 @@ object Renderers {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@IDEAPluginsCompatibilityAPI(
|
||||
IDEAPlatforms._213, // maybe 211 or 212 AS also used it
|
||||
message = "Please use the CommonRenderers.commaSeparated instead",
|
||||
plugins = "Android plugin in IDEA"
|
||||
)
|
||||
fun <T> commaSeparated(itemRenderer: DiagnosticParameterRenderer<T>): DiagnosticParameterRenderer<Collection<T>> =
|
||||
CommonRenderers.commaSeparated(itemRenderer)
|
||||
|
||||
@JvmField
|
||||
val TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS_RENDERER = Renderer<InferenceErrorData> {
|
||||
renderConflictingSubstitutionsInferenceError(it, TabledDescriptorRenderer.create()).toString()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.resolve.calls.callUtil
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.incremental.KotlinLookupLocation
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -16,6 +17,7 @@ import org.jetbrains.kotlin.resolve.calls.util.getType
|
||||
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.resolve.calls.util.getParameterForArgument
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.IDEAPlatforms
|
||||
import org.jetbrains.kotlin.utils.IDEAPluginsCompatibilityAPI
|
||||
@@ -72,3 +74,11 @@ fun KtExpression.createLookupLocation(): KotlinLookupLocation? = createLookupLoc
|
||||
plugins = "Android in IDEA"
|
||||
)
|
||||
fun Call.getValueArgumentForExpression(expression: KtExpression): ValueArgument? = getValueArgumentForExpression(expression)
|
||||
|
||||
@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 <D : CallableDescriptor> ResolvedCall<D>.getParameterForArgument(valueArgument: ValueArgument?): ValueParameterDescriptor? =
|
||||
getParameterForArgument(valueArgument)
|
||||
|
||||
Reference in New Issue
Block a user