suppress deprecation warnings about (Use)Experimental

We cannot use (Requires)DropIn as it was introduced in 1.3.70 and we
want to support Kotlin 1.2
This commit is contained in:
Robert Stoll
2020-03-15 21:42:31 +01:00
parent 53cc7fc104
commit 971839ab16
12 changed files with 20 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions
import ch.tutteli.atrium.reporting.RawString
import ch.tutteli.atrium.reporting.reporter
@Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@Experimental
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
@@ -63,6 +64,7 @@ fun <T> RootExpect<T>.withOptions(configuration: ExpectBuilder.OptionsChooser<T>
* @return An [Expect] for the current subject of the assertion.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
fun <T> RootExpect<T>.withOptions(options: ExpectOptions<T>): Expect<T> = coreFactory.newReportingAssertionContainer(
ReportingAssertionContainer.AssertionCheckerDecorator.create(
@@ -122,6 +124,7 @@ fun <T, R> FeatureExpect<T, R>.withOptions(configuration: FeatureExtractorBuilde
* @return An [Expect] for the current subject of the assertion.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
fun <T, R> FeatureExpect<T, R>.withOptions(options: FeatureOptions<R>): Expect<R> =
coreFactory.newFeatureExpect(

View File

@@ -10,6 +10,7 @@ import ch.tutteli.atrium.domain.builders.reporting.ExpectOptions
import ch.tutteli.atrium.reporting.RawString
import ch.tutteli.atrium.reporting.reporter
@Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@Experimental
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.FUNCTION)
@@ -55,6 +56,7 @@ infix fun <T> RootExpect<T>.withOptions(configuration: ExpectBuilder.OptionsChoo
* Uses the given [options] to override (parts) of the existing configuration.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
infix fun <T> RootExpect<T>.withOptions(options: ExpectOptions<T>): Expect<T> =
coreFactory.newReportingAssertionContainer(
@@ -107,6 +109,7 @@ infix fun <T, R> FeatureExpect<T, R>.withOptions(configuration: FeatureExtractor
* Uses the given [options] to override (parts) of the existing configuration.
*/
@ExperimentalWithOptions
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
infix fun <T, R> FeatureExpect<T, R>.withOptions(options: FeatureOptions<R>): Expect<R> =
coreFactory.newFeatureExpect(

View File

@@ -207,6 +207,7 @@ interface CoreFactoryCommon {
//TODO #280 add KDoc
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
fun <T, R> newFeatureExpect(
previousExpect: Expect<T>,

View File

@@ -2,7 +2,7 @@ package ch.tutteli.atrium.creating
import ch.tutteli.atrium.reporting.translating.Translatable
@Suppress("DEPRECATION" /* RequiresOptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@Experimental
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)

View File

@@ -17,6 +17,7 @@ interface RootExpect<T> : Expect<T> {
/**
* The chosen [RootExpectConfig].
*/
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
val config: RootExpectConfig
}
@@ -39,6 +40,7 @@ interface FeatureExpect<T, R> : Expect<R> {
/**
* The chosen [FeatureExpectConfig].
*/
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
val config: FeatureExpectConfig

View File

@@ -14,6 +14,7 @@ import ch.tutteli.atrium.creating.FeatureExpectConfig
class FeatureExpectImpl<T, R>(
override val previousExpect: Expect<T>,
override val maybeSubject: Option<R>,
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
override val config: FeatureExpectConfig,
private val assertionChecker: AssertionChecker,
@@ -45,6 +46,7 @@ class FeatureExpectImpl<T, R>(
return this
}
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
private fun checkAndClearAssertions(): Expect<R> {
try {
@@ -54,8 +56,7 @@ class FeatureExpectImpl<T, R>(
} finally {
clearAssertions()
}
return this
}
return this }
override fun getAssertions(): List<Assertion> = getCopyOfAssertions()
}

View File

@@ -11,7 +11,7 @@ class ReportingAssertionContainerImpl<T>(
private val assertionCheckerDecorator: ReportingAssertionContainer.AssertionCheckerDecorator<T>
) : MutableListBasedAssertionContainer<T>(assertionCheckerDecorator.maybeSubject),
ReportingAssertionContainer<T> {
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
override val config: RootExpectConfig =
RootExpectConfig.create(

View File

@@ -34,6 +34,7 @@ abstract class CoreFactoryCommonImpl : CoreFactoryCommon {
final override fun <T, R> newFeatureExpect(
previousExpect: Expect<T>,
maybeSubject: Option<R>,
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
featureConfig: FeatureExpectConfig,
assertions: List<Assertion>

View File

@@ -14,6 +14,7 @@ import ch.tutteli.atrium.domain.builders.ExpectImpl
import ch.tutteli.atrium.domain.builders.creating.collectors.collectAssertions
import ch.tutteli.atrium.reporting.translating.Translatable
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalExpectConfig::class)
fun <T, R> _extractFeature(
originalAssertionContainer: Expect<T>,

View File

@@ -14,6 +14,7 @@ import ch.tutteli.atrium.reporting.reporter
import ch.tutteli.atrium.translations.DescriptionFunLikeAssertion.*
import kotlin.reflect.KClass
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalWithOptions::class)
fun <TExpected : Throwable> _isThrowing(
expect: Expect<out () -> Any?>,

View File

@@ -10,8 +10,9 @@ import ch.tutteli.atrium.reporting.RawString
import ch.tutteli.atrium.translations.DescriptionThrowableAssertion
import kotlin.reflect.KClass
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalWithOptions::class)
fun <T: Throwable, TExpected : Throwable> _cause(
fun <T : Throwable, TExpected : Throwable> _cause(
expect: Expect<T>,
expectedType: KClass<TExpected>
): ChangedSubjectPostStep<Throwable?, TExpected> =

View File

@@ -24,6 +24,7 @@ fun <E, T : Result<E>> _isSuccess(expect: Expect<T>): ExtractedFeaturePostStep<T
.withoutOptions()
.build()
@Suppress("DEPRECATION" /* OptIn is only available since 1.3.70 which we cannot use if we want to support 1.2 */)
@UseExperimental(ExperimentalWithOptions::class)
fun <TExpected : Throwable> _isFailure(
expect: Expect<out Result<*>>,