Rename Experimental/UseExperimental in compiler diagnostic messages

#KT-34647
This commit is contained in:
Alexander Udalov
2019-12-18 19:38:51 +01:00
parent d547af00aa
commit b839b905b5
8 changed files with 21 additions and 21 deletions
@@ -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(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_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(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, "Experimental annotation cannot be used on the following code elements: {0}. Please remove these targets", 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, "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); MAP.put(EXPERIMENTAL_UNSIGNED_LITERALS_ERROR, "Unsigned literals are experimental and their usages must be marked with ''@{0}'' or ''@OptIn({0}::class)''", TO_STRING);
@@ -224,16 +224,16 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
val deprecationResolver = val deprecationResolver =
DeprecationResolver(LockBasedStorageManager("ExperimentalUsageChecker"), languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, DeprecationSettings.Default) 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 { fun checkAnnotation(fqName: String): Boolean {
val descriptor = module.resolveClassByFqName(FqName(fqName), NoLookupLocation.FOR_NON_TRACKED_SCOPE) val descriptor = module.resolveClassByFqName(FqName(fqName), NoLookupLocation.FOR_NON_TRACKED_SCOPE)
if (descriptor == null) { 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 return false
} }
if (descriptor.loadExperimentalityForMarkerAnnotation() == null) { 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 return false
} }
@@ -242,7 +242,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
DeprecationLevelValue.WARNING -> reportWarning DeprecationLevelValue.WARNING -> reportWarning
DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> reportError 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 return true
} }
@@ -253,7 +253,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
} }
for (fqName in validExperimental.intersect(validUseExperimental)) { 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")
} }
} }
} }
@@ -1,2 +1,2 @@
error: '-Xuse-experimental=org.test.ExperimentalAPI' has no effect because '-Xexperimental=org.test.ExperimentalAPI' is used error: '-Xopt-in=org.test.ExperimentalAPI' has no effect because '-Xexperimental=org.test.ExperimentalAPI' is used
COMPILATION_ERROR COMPILATION_ERROR
+4 -4
View File
@@ -1,5 +1,5 @@
error: experimental API marker org.test.Error1 is deprecated. Error1 error: opt-in requirement marker org.test.Error1 is deprecated. Error1
error: experimental API marker org.test.Hidden1 is deprecated. Hidden1 error: opt-in requirement marker org.test.Hidden1 is deprecated. Hidden1
error: experimental API marker org.test.Error2 is deprecated. Error2 error: opt-in requirement marker org.test.Error2 is deprecated. Error2
error: experimental API marker org.test.Hidden2 is deprecated. Hidden2 error: opt-in requirement marker org.test.Hidden2 is deprecated. Hidden2
COMPILATION_ERROR COMPILATION_ERROR
@@ -1,4 +1,4 @@
warning: '-Xexperimental' is deprecated and will be removed in a future release warning: '-Xexperimental' is deprecated and will be removed in a future release
warning: experimental API marker org.test.Warning2 is deprecated. Warning2 warning: opt-in requirement marker org.test.Warning2 is deprecated. Warning2
warning: experimental API marker org.test.Warning1 is deprecated. Warning1 warning: opt-in requirement marker org.test.Warning1 is deprecated. Warning1
OK OK
+2 -2
View File
@@ -1,4 +1,4 @@
warning: '-Xexperimental' is deprecated and will be removed in a future release warning: '-Xexperimental' is deprecated and will be removed in a future release
warning: class org.test.NotAnAnnotation1 is not an experimental API marker annotation warning: class org.test.NotAnAnnotation1 is not an opt-in requirement marker
warning: class org.test.NotAnAnnotation2 is not an experimental API marker annotation warning: class org.test.NotAnAnnotation2 is not an opt-in requirement marker
OK OK
+2 -2
View File
@@ -1,4 +1,4 @@
warning: '-Xexperimental' is deprecated and will be removed in a future release warning: '-Xexperimental' is deprecated and will be removed in a future release
warning: class org.test.NotAMarker1 is not an experimental API marker annotation warning: class org.test.NotAMarker1 is not an opt-in requirement marker
warning: class org.test.NotAMarker2 is not an experimental API marker annotation warning: class org.test.NotAMarker2 is not an opt-in requirement marker
OK OK
+3 -3
View File
@@ -1,5 +1,5 @@
warning: '-Xexperimental' is deprecated and will be removed in a future release warning: '-Xexperimental' is deprecated and will be removed in a future release
warning: experimental API marker org.test.Unresolved2 is unresolved. Please make sure it's present in the module dependencies warning: opt-in requirement marker org.test.Unresolved2 is unresolved. Please make sure it's present in the module dependencies
warning: experimental API marker org.test.Unresolved1 is unresolved. Please make sure it's present in the module dependencies warning: opt-in requirement marker org.test.Unresolved1 is unresolved. Please make sure it's present in the module dependencies
warning: experimental API marker org.test.Unresolved3 is unresolved. Please make sure it's present in the module dependencies warning: opt-in requirement marker org.test.Unresolved3 is unresolved. Please make sure it's present in the module dependencies
OK OK