Rename Experimental/UseExperimental in compiler diagnostic messages
#KT-34647
This commit is contained in:
+2
-2
@@ -158,8 +158,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(EXPERIMENTAL_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_USE_EXPERIMENTAL, "This class can only be used as an annotation or as an argument to @OptIn");
|
||||
|
||||
MAP.put(USE_EXPERIMENTAL_WITHOUT_ARGUMENTS, "@OptIn without any arguments has no effect");
|
||||
MAP.put(USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER, "Annotation ''{0}'' is not an experimental API marker, therefore its usage in @OptIn is ignored", TO_STRING);
|
||||
MAP.put(EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET, "Experimental annotation cannot be used on the following code elements: {0}. Please remove these targets", STRING);
|
||||
MAP.put(USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER, "Annotation ''{0}'' is not an opt-in requirement marker, therefore its usage in @OptIn is ignored", TO_STRING);
|
||||
MAP.put(EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET, "Opt-in requirement marker annotation cannot be used on the following code elements: {0}. Please remove these targets", STRING);
|
||||
|
||||
MAP.put(EXPERIMENTAL_UNSIGNED_LITERALS, "Unsigned literals are experimental and their usages should be marked with ''@{0}'' or ''@OptIn({0}::class)''", TO_STRING);
|
||||
MAP.put(EXPERIMENTAL_UNSIGNED_LITERALS_ERROR, "Unsigned literals are experimental and their usages must be marked with ''@{0}'' or ''@OptIn({0}::class)''", TO_STRING);
|
||||
|
||||
+5
-5
@@ -224,16 +224,16 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
val deprecationResolver =
|
||||
DeprecationResolver(LockBasedStorageManager("ExperimentalUsageChecker"), languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, DeprecationSettings.Default)
|
||||
|
||||
// Returns true if fqName refers to a valid experimental API marker.
|
||||
// Returns true if fqName resolves to a valid opt-in requirement marker.
|
||||
fun checkAnnotation(fqName: String): Boolean {
|
||||
val descriptor = module.resolveClassByFqName(FqName(fqName), NoLookupLocation.FOR_NON_TRACKED_SCOPE)
|
||||
if (descriptor == null) {
|
||||
reportWarning("Experimental API marker $fqName is unresolved. Please make sure it's present in the module dependencies")
|
||||
reportWarning("Opt-in requirement marker $fqName is unresolved. Please make sure it's present in the module dependencies")
|
||||
return false
|
||||
}
|
||||
|
||||
if (descriptor.loadExperimentalityForMarkerAnnotation() == null) {
|
||||
reportWarning("Class $fqName is not an experimental API marker annotation")
|
||||
reportWarning("Class $fqName is not an opt-in requirement marker")
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
DeprecationLevelValue.WARNING -> reportWarning
|
||||
DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> reportError
|
||||
}
|
||||
report("Experimental API marker $fqName is deprecated" + deprecation.message?.let { ". $it" }.orEmpty())
|
||||
report("Opt-in requirement marker $fqName is deprecated" + deprecation.message?.let { ". $it" }.orEmpty())
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -253,7 +253,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
|
||||
}
|
||||
|
||||
for (fqName in validExperimental.intersect(validUseExperimental)) {
|
||||
reportError("'-Xuse-experimental=$fqName' has no effect because '-Xexperimental=$fqName' is used")
|
||||
reportError("'-Xopt-in=$fqName' has no effect because '-Xexperimental=$fqName' is used")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user