Skip to content

Commit 845b760

Browse files
committed
upgrade to groovy 4
1 parent a25f93b commit 845b760

13 files changed

+30
-36
lines changed

build.gradle

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ jar {
9797
attributes('Automatic-Module-Name': 'com.graphqljava')
9898
}
9999
}
100-
100+
tasks.withType(GroovyCompile) {
101+
// Options when compiling Java using the Groovy plugin.
102+
// (Groovy itself defaults to UTF-8 for Groovy code)
103+
options.encoding = 'UTF-8'
104+
groovyOptions.forkOptions.memoryMaximumSize = "4g"
105+
}
101106
dependencies {
102107
implementation 'org.antlr:antlr4-runtime:' + antlrVersion
103108
api 'com.graphql-java:java-dataloader:3.4.0'
@@ -106,13 +111,15 @@ dependencies {
106111
antlr 'org.antlr:antlr4:' + antlrVersion
107112
implementation 'com.google.guava:guava:' + guavaVersion
108113
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
109-
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
110-
testImplementation 'org.codehaus.groovy:groovy:3.0.24'
111-
testImplementation 'org.codehaus.groovy:groovy-json:3.0.24'
114+
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
115+
testImplementation 'net.bytebuddy:byte-buddy:1.17.5'
116+
testImplementation 'org.objenesis:objenesis:3.4'
117+
testImplementation 'org.apache.groovy:groovy:4.0.26"'
118+
testImplementation 'org.apache.groovy:groovy-json:4.0.26'
112119
testImplementation 'com.google.code.gson:gson:2.12.1'
113120
testImplementation 'org.eclipse.jetty:jetty-server:11.0.25'
114121
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.18.3'
115-
testImplementation 'org.awaitility:awaitility-groovy:4.2.0'
122+
testImplementation 'org.awaitility:awaitility-groovy:4.3.0'
116123
testImplementation 'com.github.javafaker:javafaker:1.0.2'
117124

118125
testImplementation 'org.reactivestreams:reactive-streams-tck:' + reactiveStreamsVersion
@@ -220,9 +227,9 @@ generateGrammarSource {
220227
outputDirectory = file("${project.buildDir}/generated-src/antlr/main/graphql/parser/antlr")
221228
}
222229
generateGrammarSource.inputs
223-
.dir('src/main/antlr')
224-
.withPropertyName('sourceDir')
225-
.withPathSensitivity(PathSensitivity.RELATIVE)
230+
.dir('src/main/antlr')
231+
.withPropertyName('sourceDir')
232+
.withPathSensitivity(PathSensitivity.RELATIVE)
226233

227234

228235
task sourcesJar(type: Jar) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.caching=true
22
org.gradle.daemon=true
33
org.gradle.parallel=true
4-
org.gradle.jvmargs=-Dfile.encoding=UTF-8
4+
org.gradle.jvmargs=-Dfile.encoding=UTF-8

src/test/groovy/graphql/analysis/values/ValueTraverserTest.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import graphql.schema.GraphQLObjectType
2121
import graphql.schema.GraphQLScalarType
2222
import graphql.schema.idl.SchemaDirectiveWiring
2323
import graphql.schema.idl.SchemaDirectiveWiringEnvironment
24-
import org.jetbrains.annotations.Nullable
2524
import spock.lang.Specification
2625

2726
import static graphql.schema.idl.RuntimeWiring.newRuntimeWiring
@@ -323,7 +322,7 @@ class ValueTraverserTest extends Specification {
323322
]
324323
def visitor = new ValueVisitor() {
325324
@Override
326-
Object visitArgumentValue(@Nullable Object coercedValue, GraphQLArgument graphQLArgument, ValueVisitor.InputElements inputElements) {
325+
Object visitArgumentValue(Object coercedValue, GraphQLArgument graphQLArgument, ValueVisitor.InputElements inputElements) {
327326
if (graphQLArgument.name == "arg2") {
328327
return [name: "Harry Potter", age: 54]
329328
}
@@ -402,15 +401,15 @@ class ValueTraverserTest extends Specification {
402401
def visitor = new ValueVisitor() {
403402

404403
@Override
405-
Object visitScalarValue(@Nullable Object coercedValue, GraphQLScalarType inputType, ValueVisitor.InputElements inputElements) {
404+
Object visitScalarValue(Object coercedValue, GraphQLScalarType inputType, ValueVisitor.InputElements inputElements) {
406405
if (coercedValue == "Tom Riddle") {
407406
return "Happy Potter"
408407
}
409408
return coercedValue
410409
}
411410

412411
@Override
413-
Object visitAppliedDirectiveArgumentValue(@Nullable Object coercedValue, GraphQLAppliedDirectiveArgument graphQLAppliedDirectiveArgument, ValueVisitor.InputElements inputElements) {
412+
Object visitAppliedDirectiveArgumentValue(Object coercedValue, GraphQLAppliedDirectiveArgument graphQLAppliedDirectiveArgument, ValueVisitor.InputElements inputElements) {
414413
if (graphQLAppliedDirectiveArgument.name == "arg2") {
415414
return [name: "Harry Potter", age: 54]
416415
}

src/test/groovy/graphql/execution/incremental/IncrementalCallStateDeferTest.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import graphql.execution.ResultPath
66
import graphql.execution.pubsub.CapturingSubscriber
77
import graphql.incremental.DelayedIncrementalPartialResult
88
import org.awaitility.Awaitility
9-
import org.jetbrains.annotations.NotNull
109
import org.reactivestreams.Publisher
1110
import spock.lang.Specification
1211

@@ -242,7 +241,7 @@ class IncrementalCallStateDeferTest extends Specification {
242241

243242
def threadFactory = new ThreadFactory() {
244243
@Override
245-
Thread newThread(@NotNull Runnable r) {
244+
Thread newThread(Runnable r) {
246245
return new Thread(r, "SubscriberThread")
247246
}
248247
}

src/test/groovy/graphql/execution/instrumentation/InstrumentationTest.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import graphql.schema.DataFetchingEnvironment
1616
import graphql.schema.SingletonPropertyDataFetcher
1717
import graphql.schema.StaticDataFetcher
1818
import org.awaitility.Awaitility
19-
import org.jetbrains.annotations.NotNull
2019
import spock.lang.Specification
2120

2221
import java.util.concurrent.CompletableFuture
@@ -183,7 +182,6 @@ class InstrumentationTest extends Specification {
183182
}
184183
}
185184

186-
@NotNull
187185
@Override
188186
DataFetcher<?> instrumentDataFetcher(DataFetcher<?> dataFetcher, InstrumentationFieldFetchParameters parameters, InstrumentationState state) {
189187
System.out.println(String.format("t%s instrument DF for %s", Thread.currentThread().getId(), parameters.environment.getExecutionStepInfo().getPath()))

src/test/groovy/graphql/execution/instrumentation/TestingFieldFetchingInstrumentationContext.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package graphql.execution.instrumentation
22

3-
class TestingFieldFetchingInstrumentationContext extends TestingInstrumentContext<Map<String, Object>> implements FieldFetchingInstrumentationContext {
3+
class TestingFieldFetchingInstrumentationContext extends TestingInstrumentContext<Object> implements FieldFetchingInstrumentationContext {
44

55
TestingFieldFetchingInstrumentationContext(Object op, Object executionList, Object throwableList, Boolean useOnDispatch) {
66
super(op, executionList, throwableList, useOnDispatch)

src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatcherTest.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.awaitility.Awaitility
1616
import org.dataloader.BatchLoader
1717
import org.dataloader.DataLoaderFactory
1818
import org.dataloader.DataLoaderRegistry
19-
import org.jetbrains.annotations.NotNull
2019
import org.reactivestreams.Publisher
2120
import reactor.core.publisher.Mono
2221
import spock.lang.Specification
@@ -96,7 +95,6 @@ class DataLoaderDispatcherTest extends Specification {
9695

9796
def enhancingInstrumentation = new SimplePerformantInstrumentation() {
9897

99-
@NotNull
10098
@Override
10199
ExecutionInput instrumentExecutionInput(ExecutionInput executionInput, InstrumentationExecutionParameters parameters, InstrumentationState state) {
102100
assert executionInput.getDataLoaderRegistry() == startingDataLoaderRegistry

src/test/groovy/graphql/execution/values/InputInterceptorTest.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import graphql.execution.ValuesResolver
1010
import graphql.schema.DataFetcher
1111
import graphql.schema.DataFetchingEnvironment
1212
import graphql.schema.GraphQLInputType
13-
import org.jetbrains.annotations.NotNull
14-
import org.jetbrains.annotations.Nullable
1513
import spock.lang.Specification
1614

1715
import static graphql.language.TypeName.newTypeName
@@ -35,7 +33,7 @@ class InputInterceptorTest extends Specification {
3533

3634
InputInterceptor interceptor = new InputInterceptor() {
3735
@Override
38-
Object intercept(@Nullable Object value, @NotNull GraphQLInputType graphQLType, @NotNull GraphQLContext graphqlContext, @NotNull Locale locale) {
36+
Object intercept(Object value, GraphQLInputType graphQLType, GraphQLContext graphqlContext, Locale locale) {
3937
if (graphQLType == Scalars.GraphQLBoolean) {
4038
return "truthy" == value ? false : value
4139
}

src/test/groovy/graphql/extensions/ExtensionsBuilderTest.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import graphql.execution.DataFetcherResult
66
import graphql.schema.DataFetcher
77
import graphql.schema.DataFetchingEnvironment
88
import graphql.schema.GraphQLTypeUtil
9-
import org.jetbrains.annotations.NotNull
109
import spock.lang.Specification
1110

1211
import static graphql.ExecutionInput.newExecutionInput
@@ -106,8 +105,7 @@ class ExtensionsBuilderTest extends Specification {
106105
def "can use a custom merger"() {
107106
ExtensionsMerger merger = new ExtensionsMerger() {
108107
@Override
109-
@NotNull
110-
Map<Object, Object> merge(@NotNull Map<Object, Object> leftMap, @NotNull Map<Object, Object> rightMap) {
108+
Map<Object, Object> merge(Map<Object, Object> leftMap, Map<Object, Object> rightMap) {
111109
return rightMap
112110
}
113111
}

src/test/groovy/graphql/introspection/IntrospectionResultToSchemaTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ input CharacterInput {
377377
"subscriptionType": {"name":"SubscriptionType"},
378378
"types": [
379379
]
380-
}"""
380+
}}"""
381381
def parsed = slurp(input)
382382

383383
when:
@@ -826,7 +826,7 @@ directiveArg: String = "default Value") on FIELD | FRAGMENT_SPREAD | INLINE_FRAG
826826
"isRepeatable":true
827827
}
828828
]
829-
}"""
829+
}}"""
830830
def parsed = slurp(input)
831831

832832
when:

0 commit comments

Comments
 (0)