Skip to content

Commit 1ff7212

Browse files
authored
fix languageVersion doc (#5125)
1 parent d101fb2 commit 1ff7212

File tree

3 files changed

+4
-13
lines changed
  • libraries

3 files changed

+4
-13
lines changed

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/model/ModelBuilder.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.apollographql.apollo3.compiler.codegen.kotlin.model
22

3-
import com.apollographql.apollo3.compiler.TargetLanguage.KOTLIN_1_5
43
import com.apollographql.apollo3.compiler.applyIf
54
import com.apollographql.apollo3.compiler.codegen.CodegenLayout.Companion.upperCamelCaseIgnoringNonLetters
65
import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinContext
7-
import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinMemberNames
86
import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinSymbols
97
import com.apollographql.apollo3.compiler.codegen.kotlin.adapter.from
108
import com.apollographql.apollo3.compiler.codegen.kotlin.helpers.makeDataClassFromProperties
@@ -81,7 +79,7 @@ internal class ModelBuilder(
8179
val typeSpecBuilder = if (isInterface) {
8280
TypeSpec.interfaceBuilder(simpleName)
8381
// All interfaces can be sealed except if implementations exist in different packages (not allowed in Kotlin)
84-
.applyIf(context.isTargetLanguageVersionAtLeast(KOTLIN_1_5) && hasSubclassesInSamePackage) {
82+
.applyIf(hasSubclassesInSamePackage) {
8583
addModifiers(KModifier.SEALED)
8684
}
8785
.addProperties(properties)

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/Service.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,9 @@ interface Service {
390390
*
391391
* Only valid when [generateKotlinModels] is `true`.
392392
*
393-
* Must be either "1.4" or "1.5".
393+
* For now only "1.5" is supported. Other versions might be added later as the Kotlin language evolves.
394394
*
395-
* Note: "1.4", while still supported, is not useful since Apollo Kotlin requires Kotlin 1.5+. It is considered deprecated.
396-
*
397-
* Using an higher languageVersion allows generated code to use more language features like
398-
* sealed interfaces in Kotlin 1.5 for an example.
399-
*
400-
* See also https://kotlinlang.org/docs/gradle.html#attributes-common-to-jvm-and-js
401-
*
402-
* Default: use the version of the Kotlin plugin.
395+
* Default: "1.5"
403396
*/
404397
val languageVersion: Property<String>
405398

libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/KotlinPluginFacade.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun getKotlinTargetLanguage(userSpecified: String?): TargetLanguage {
2525
// val majorMinor = project.getKotlinPluginVersion()!!.take(3)
2626
TargetLanguage.KOTLIN_1_5
2727
}
28-
else -> error("Apollo: languageVersion '$userSpecified' is not supported, must be either '1.4' or '1.5'")
28+
else -> error("Apollo: languageVersion '$userSpecified' is not supported, Apollo Kotlin always generate Kotlin '1.5' source files")
2929
}
3030
}
3131

0 commit comments

Comments
 (0)