Skip to content

Commit 377cc2c

Browse files
authored
Merge branch 'master' into graphql-java-26
2 parents 0acdea5 + b6feaf7 commit 377cc2c

9 files changed

Lines changed: 236 additions & 48 deletions

File tree

‎.github/workflows/pull-request.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
java: [ '11', '15', '17' ]
10+
java: [ '11', '17', '21', '25' ]
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v6
13+
uses: actions/checkout@v7
1414
- name: Setup java
15-
uses: actions/setup-java@v5
15+
uses: actions/setup-java@v6
1616
with:
1717
java-version: ${{ matrix.java }}
18-
distribution: 'adopt'
18+
distribution: 'temurin'
1919
- name: Cache Maven packages
20-
uses: actions/cache@v5
20+
uses: actions/cache@v6
2121
with:
2222
path: ~/.m2
2323
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

‎.github/workflows/release.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- name: Checkout
8-
uses: actions/checkout@v6
8+
uses: actions/checkout@v7
99
- name: Setup java
10-
uses: actions/setup-java@v5
10+
uses: actions/setup-java@v6
1111
with:
1212
java-version: '11'
13-
distribution: 'adopt'
13+
distribution: 'temurin'
1414
- name: Build with Maven
1515
run: mvn --batch-mode --update-snapshots verify
1616

@@ -19,12 +19,12 @@ jobs:
1919
needs: build
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@v7
2323
- name: Setup Maven Central
24-
uses: actions/setup-java@v5
24+
uses: actions/setup-java@v6
2525
with:
2626
java-version: '11'
27-
distribution: 'adopt'
27+
distribution: 'temurin'
2828
server-id: central
2929
server-username: MAVEN_USERNAME
3030
server-password: MAVEN_PASSWORD

‎.github/workflows/snapshot.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v6
11+
uses: actions/checkout@v7
1212
- name: Setup java
13-
uses: actions/setup-java@v5
13+
uses: actions/setup-java@v6
1414
with:
1515
java-version: '11'
16-
distribution: 'adopt'
16+
distribution: 'temurin'
1717
- name: Build with Maven
1818
run: mvn --batch-mode --update-snapshots verify
1919

@@ -22,12 +22,12 @@ jobs:
2222
needs: build
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v6
25+
uses: actions/checkout@v7
2626
- name: Setup Maven Central
27-
uses: actions/setup-java@v5
27+
uses: actions/setup-java@v6
2828
with:
2929
java-version: '11'
30-
distribution: 'adopt'
30+
distribution: 'temurin'
3131
server-id: central
3232
server-username: MAVEN_USERNAME
3333
server-password: MAVEN_PASSWORD

‎pom.xml‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<java.version>11</java.version>
1717
<kotlin.version>2.3.10</kotlin.version>
1818
<kotlin-coroutines.version>1.10.2</kotlin-coroutines.version>
19-
<jackson.version>2.21.0</jackson.version>
19+
<jackson.version>2.22.3</jackson.version>
2020
<graphql-java.version>26.1</graphql-java.version>
2121
<reactive-streams.version>1.0.4</reactive-streams.version>
2222

@@ -68,19 +68,19 @@
6868
<dependency>
6969
<groupId>org.slf4j</groupId>
7070
<artifactId>slf4j-api</artifactId>
71-
<version>2.0.17</version>
71+
<version>2.0.20</version>
7272
</dependency>
7373
<dependency>
7474
<groupId>org.apache.commons</groupId>
7575
<artifactId>commons-lang3</artifactId>
76-
<version>3.20.0</version>
76+
<version>3.21.0</version>
7777
</dependency>
7878

7979
<!-- Optional for supporting Javassist proxies -->
8080
<dependency>
8181
<groupId>org.javassist</groupId>
8282
<artifactId>javassist</artifactId>
83-
<version>3.30.2-GA</version>
83+
<version>3.33.0-GA</version>
8484
<scope>provided</scope>
8585
</dependency>
8686
<!-- Optional for supporting Spring proxies -->
@@ -100,7 +100,7 @@
100100
<dependency>
101101
<groupId>ch.qos.logback</groupId>
102102
<artifactId>logback-classic</artifactId>
103-
<version>1.5.32</version>
103+
<version>1.6.5</version>
104104
</dependency>
105105
<dependency>
106106
<groupId>javax.servlet</groupId>
@@ -115,7 +115,7 @@
115115
<dependency>
116116
<groupId>org.objenesis</groupId>
117117
<artifactId>objenesis</artifactId>
118-
<version>3.5</version>
118+
<version>3.6</version>
119119
</dependency>
120120
<dependency>
121121
<groupId>org.reactivestreams</groupId>
@@ -240,7 +240,7 @@
240240
<plugin>
241241
<groupId>org.codehaus.mojo</groupId>
242242
<artifactId>build-helper-maven-plugin</artifactId>
243-
<version>3.6.1</version>
243+
<version>3.6.2</version>
244244
<executions>
245245
<execution>
246246
<id>add-test-source</id>
@@ -284,7 +284,7 @@
284284
<plugin>
285285
<groupId>org.apache.maven.plugins</groupId>
286286
<artifactId>maven-compiler-plugin</artifactId>
287-
<version>3.15.0</version>
287+
<version>3.16.0</version>
288288
<configuration>
289289
<source>11</source>
290290
<target>11</target>
@@ -294,12 +294,12 @@
294294
<plugin>
295295
<groupId>org.apache.maven.plugins</groupId>
296296
<artifactId>maven-surefire-plugin</artifactId>
297-
<version>3.5.4</version>
297+
<version>3.6.0</version>
298298
<dependencies>
299299
<dependency>
300300
<groupId>org.apache.maven.surefire</groupId>
301301
<artifactId>surefire-junit4</artifactId>
302-
<version>3.5.4</version>
302+
<version>3.5.6</version>
303303
</dependency>
304304
</dependencies>
305305
<configuration>
@@ -311,7 +311,7 @@
311311
<plugin>
312312
<groupId>org.apache.maven.plugins</groupId>
313313
<artifactId>maven-jar-plugin</artifactId>
314-
<version>3.5.0</version>
314+
<version>3.5.1</version>
315315
<executions>
316316
<execution>
317317
<id>test-jar</id>
@@ -326,7 +326,7 @@
326326
<plugin>
327327
<groupId>org.apache.maven.plugins</groupId>
328328
<artifactId>maven-enforcer-plugin</artifactId>
329-
<version>3.6.2</version>
329+
<version>3.6.3</version>
330330
<executions>
331331
<execution>
332332
<id>enforce</id>
@@ -344,7 +344,7 @@
344344
<plugin>
345345
<groupId>org.sonatype.central</groupId>
346346
<artifactId>central-publishing-maven-plugin</artifactId>
347-
<version>0.9.0</version>
347+
<version>0.11.0</version>
348348
<extensions>true</extensions>
349349
<configuration>
350350
<publishingServerId>central</publishingServerId>

‎renovate.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
"org.springframework"
3131
],
3232
"allowedVersions": "<6.0.0"
33+
},
34+
{
35+
"description": "Release/snapshot builds use the minimum supported JDK",
36+
"matchDepNames": [
37+
"java-jdk"
38+
],
39+
"enabled": false
3340
}
3441
]
3542
}

‎src/main/kotlin/graphql/kickstart/tools/GenericType.kt‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,13 @@ internal open class GenericType(protected val mostSpecificType: JavaType, protec
151151
}
152152
}
153153
is TypeVariable<*> -> {
154-
if (declaringType is ParameterizedType) {
155-
TypeUtils.getRawType(type, declaringType)
154+
val genericDeclaration = type.genericDeclaration
155+
if (declaringType is ParameterizedType && genericDeclaration is Class<*>) {
156+
// keep the full type argument (e.g. List<Foo>) rather than its raw class so nested generics aren't lost
157+
TypeUtils.getTypeArguments(declaringType, genericDeclaration)?.get(type)
158+
?.takeIf { it != type }
159+
?.let { replaceTypeVariable(it) }
160+
?: type
156161
} else {
157162
type
158163
}

‎src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt‎

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,42 @@ internal class SchemaClassScanner(
8686
handleDictionaryTypes(getAllObjectTypeMembersOfDiscoveredUnions()) { "Object type '${it.name}' is a member of a known union, but no class could be found for that type name. Please pass a class for type '${it.name}' in the parser's dictionary." }
8787
} while (scanQueue())
8888

89+
handleDirectives()
90+
8991
// Find unused types and include them if required
9092
if (options.includeUnusedTypes) {
91-
do {
92-
val unusedDefinitions = (definitionsByName.values - (dictionary.keys.toSet() + unvalidatedTypes))
93+
// One type at a time, since scanning it can discover other unused types along with their classes
94+
while (true) {
95+
val unusedDefinition = (definitionsByName.values - (dictionary.keys.toSet() + unvalidatedTypes))
9396
.filter { definition -> definition.name != "PageInfo" }
94-
.filterIsInstance<ObjectTypeDefinition>().distinct()
95-
96-
if (unusedDefinitions.isEmpty()) {
97-
break
98-
}
97+
.firstOrNull { canIncludeUnusedType(it) }
98+
?: break
9999

100-
val unusedDefinition = unusedDefinitions.first()
101-
102-
handleDictionaryTypes(listOf(unusedDefinition)) { "Object type '${it.name}' is unused and includeUnusedTypes is true. Please pass a class for type '${it.name}' in the parser's dictionary." }
103-
} while (scanQueue())
100+
handleUnusedType(unusedDefinition)
101+
scanQueue()
102+
}
104103
}
105104

106-
handleDirectives()
107-
108105
return validateAndCreateResult(rootTypeHolder)
109106
}
110107

108+
private fun canIncludeUnusedType(definition: TypeDefinition<*>): Boolean = when (definition) {
109+
is ObjectTypeDefinition, is InterfaceTypeDefinition, is UnionTypeDefinition -> true
110+
// Enums can't be built without a class, so the ones missing from the dictionary are only reported as unused
111+
is EnumTypeDefinition -> initialDictionary.containsKey(definition.name)
112+
else -> false
113+
}
114+
115+
private fun handleUnusedType(type: TypeDefinition<*>) {
116+
val initialEntry = initialDictionary[type.name]
117+
when {
118+
initialEntry != null -> handleFoundType(type, initialEntry.get(), DictionaryReference())
119+
// Interfaces and unions are resolved through the classes of their implementations, so they don't need one
120+
type is InterfaceTypeDefinition || type is UnionTypeDefinition -> handleFoundType(type, null, UnusedTypeReference())
121+
else -> throw SchemaClassScannerError("Object type '${type.name}' is unused and includeUnusedTypes is true. Please pass a class for type '${type.name}' in the parser's dictionary.")
122+
}
123+
}
124+
111125
private fun scanQueue(): Boolean {
112126
if (queue.isEmpty()) {
113127
return false
@@ -368,7 +382,7 @@ internal class SchemaClassScanner(
368382
handleFoundType(typeClassMatcher.match(TypeClassMatcher.PotentialMatch.parameterType(
369383
inputValueDefinition.type,
370384
inputValueJavaType,
371-
GenericType(javaType, options).relativeToType(inputValueJavaType),
385+
GenericType(javaType, options).relativeToType(javaType),
372386
InputObjectReference(inputValueDefinition)
373387
)))
374388
} else {
@@ -463,6 +477,10 @@ internal class SchemaClassScanner(
463477
override fun getDescription() = "provided dictionary"
464478
}
465479

480+
private class UnusedTypeReference : Reference() {
481+
override fun getDescription() = "unused type"
482+
}
483+
466484
private class InterfaceReference(private val type: ObjectTypeDefinition) : Reference() {
467485
override fun getDescription() = "interface declarations of ${type.name}"
468486
}

0 commit comments

Comments
 (0)