Skip to content

Commit ddaef0f

Browse files
kbrooksKyle
authored andcommitted
Add @JvmStatic annotation to Kotlin builders (#771)
Co-authored-by: Kyle <kbrooks@github.com>
1 parent e158de9 commit ddaef0f

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@ Before sending your pull requests, make sure you followed this list:
1616
Please follow the steps below in order to make the changes:
1717

1818
1. Clone the repository
19-
2. Checkout **develop** branch.
20-
3. Open repository in your favourite IDE.
21-
4. Enable and configure CheckStyle plugin in your IDE (for IntelliJ it is CheckStyle-IDEA).
19+
2. Set the local java version to 1.8
20+
3. Checkout **develop** branch.
21+
4. Open repository in your favourite IDE.
22+
5. Enable and configure CheckStyle plugin in your IDE (for IntelliJ it is CheckStyle-IDEA).
2223
Import [graphql-codegen-check-style.xml](config/checkstyle/graphql-codegen-check-style.xml) as a .
23-
5. Make code changes to the core library of `graphql-java-codegen`.
24-
6. If changes are required in the plugin code, then **build** and **install** `graphql-java-codegen` first.
24+
6. Make code changes to the core library of `graphql-java-codegen`.
25+
7. If changes are required in the plugin code, then **build** and **install** `graphql-java-codegen` first.
2526

2627
```shell script
2728
# This will install the library (including your recent changes) in your local maven repository.
2829
./gradlew clean build publishToMavenLocal
2930
```
3031

31-
7. Build the plugin project with updated `graphql-java-codegen` library.
32+
8. Build the plugin project with updated `graphql-java-codegen` library.
3233

3334
```shell script
3435
# Build Gradle plugin
@@ -39,8 +40,8 @@ Please follow the steps below in order to make the changes:
3940
mvn clean verify
4041
```
4142

42-
8. Make changes to the plugin code
43-
9. Install the plugin (copy to your local maven repository).
43+
9. Make changes to the plugin code
44+
10. Install the plugin (copy to your local maven repository).
4445

4546
```shell script
4647
# Install Gradle plugin
@@ -51,4 +52,4 @@ Please follow the steps below in order to make the changes:
5152
mvn clean install
5253
```
5354

54-
10. Make sure that `example` projects are compiling and running.
55+
11. Make sure that `example` projects are compiling and running.

src/main/resources/templates/kotlin-lang/kotlinClassGraphqlRequest.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ open class ${className}(private val alias: String?) : GraphQLOperationRequest {
3232
val OPERATION_TYPE: GraphQLOperation = GraphQLOperation.${operationType}
3333
<#if builder>
3434

35-
fun builder(): Builder = Builder()
35+
@JvmStatic fun builder(): Builder = Builder()
3636
</#if>
3737
}
3838

src/main/resources/templates/kotlin-lang/kotlinClassGraphqlType.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ open class ${className}()<#if implements?has_content> : <#list implements as int
7575

7676
<#if builder>
7777
companion object {
78-
fun builder(): Builder = Builder()
78+
@JvmStatic fun builder(): Builder = Builder()
7979
}
8080

8181
</#if>

src/test/resources/expected-classes/kt/Commit_no_final_class.kt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ open class Commit(
6060
) : Closer, IssueTimelineItem, PullRequestTimelineItem, Subscribable, Node, GitObject, UniformResourceLocatable {
6161

6262
companion object {
63-
fun builder(): Builder = Builder()
63+
@JvmStatic fun builder(): Builder = Builder()
6464
}
6565

6666
// In the future, it maybe change.

src/test/resources/expected-classes/kt/optional/TypeWithMandatoryField.kt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data class TypeWithMandatoryField(
1010
) : InterfaceWithOptionalField {
1111

1212
companion object {
13-
fun builder(): Builder = Builder()
13+
@JvmStatic fun builder(): Builder = Builder()
1414
}
1515

1616
// In the future, it maybe change.

src/test/resources/expected-classes/kt/restricted-words/FunQueryRequest.kt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ open class FunQueryRequest(private val alias: String?) : GraphQLOperationRequest
1414
const val OPERATION_NAME: String = "fun"
1515
val OPERATION_TYPE: GraphQLOperation = GraphQLOperation.QUERY
1616

17-
fun builder(): Builder = Builder()
17+
@JvmStatic fun builder(): Builder = Builder()
1818
}
1919

2020
private val input: MutableMap<String, Any?> = LinkedHashMap()

src/test/resources/expected-classes/kt/restricted-words/Super.kt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ data class Super(
1616
) {
1717

1818
companion object {
19-
fun builder(): Builder = Builder()
19+
@JvmStatic fun builder(): Builder = Builder()
2020
}
2121

2222
// In the future, it maybe change.

0 commit comments

Comments
 (0)