Skip to content

Commit

Permalink
📠 Fix some @DeprecatedSince annotations (#3983)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD authored Apr 1, 2022
1 parent 981393b commit 198a473
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions apollo-annotations/api/apollo-annotations.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public final class com/apollographql/apollo3/annotations/ApolloDeprecatedSince$V
public static final field v3_0_0 Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
public static final field v3_0_1 Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
public static final field v3_1_1 Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
public static final field v3_2_1 Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
public static fun values ()[Lcom/apollographql/apollo3/annotations/ApolloDeprecatedSince$Version;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ annotation class ApolloDeprecatedSince(val version: Version) {
v3_0_0,
v3_0_1,
v3_1_1,
v3_2_1,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package com.apollographql.apollo3.api

import com.apollographql.apollo3.annotations.ApolloDeprecatedSince
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_1_1
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_2_1
import kotlin.jvm.JvmName
import kotlin.reflect.KClass

Expand Down Expand Up @@ -114,7 +114,7 @@ fun <T : Any> BooleanExpression<T>.evaluate(block: (T) -> Boolean): Boolean {
}

@Deprecated("Kept for binary compatibility with generated code from older versions")
@ApolloDeprecatedSince(v3_1_1)
@ApolloDeprecatedSince(v3_2_1)
@Suppress("DeprecatedCallableAddReplaceWith")
fun BooleanExpression<BTerm>.evaluate(variables: Set<String>, typename: String?): Boolean {
return evaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.apollographql.apollo3.api

import com.apollographql.apollo3.annotations.ApolloDeprecatedSince
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_0_0
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_1_1
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_2_1
import com.apollographql.apollo3.annotations.ApolloInternal
import com.apollographql.apollo3.api.internal.Version2CustomTypeAdapterToAdapter
import kotlin.jvm.JvmField
Expand Down Expand Up @@ -59,7 +59,7 @@ class CustomScalarAdapters private constructor(
}

@Deprecated("Use adapterContext.variables() instead", ReplaceWith("adapterContext.variables()"))
@ApolloDeprecatedSince(v3_1_1)
@ApolloDeprecatedSince(v3_2_1)
fun variables() = adapterContext.variables()

override val key: ExecutionContext.Key<*>
Expand Down Expand Up @@ -113,7 +113,7 @@ class CustomScalarAdapters private constructor(
}

@Deprecated("Use AdapterContext.Builder.variables() instead")
@ApolloDeprecatedSince(v3_1_1)
@ApolloDeprecatedSince(v3_2_1)
fun variables(variables: Executable.Variables): Builder = apply {
adapterContext = adapterContext.newBuilder().variables(variables).build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.apollographql.apollo3.exception

import com.apollographql.apollo3.annotations.ApolloDeprecatedSince
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_0_0
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince.Version.v3_1_1
import com.apollographql.apollo3.api.http.HttpHeader
import okio.BufferedSource

Expand Down Expand Up @@ -104,13 +105,15 @@ class HttpCacheMissException(message: String, cause: Exception? = null) : Apollo
class ApolloCompositeException(first: Throwable?, second: Throwable?) : ApolloException(message = "multiple exceptions happened", second) {

@get:Deprecated("Use suppressedExceptions instead", ReplaceWith("suppressedExceptions.first()"))
@ApolloDeprecatedSince(v3_1_1)
val first: ApolloException
get() {
val firstException = suppressedExceptions.firstOrNull()
return (firstException as? ApolloException) ?: throw RuntimeException("unexpected first exception", firstException)
}

@get:Deprecated("Use suppressedExceptions instead", ReplaceWith("suppressedExceptions.getOrNull(1)"))
@ApolloDeprecatedSince(v3_1_1)
val second: ApolloException
get() {
val secondException = suppressedExceptions.getOrNull(1)
Expand Down

0 comments on commit 198a473

Please sign in to comment.