Skip to content

Fail the build on compiler warnings and check the release bundle in CI - #849

Merged
oryan-block merged 9 commits into
masterfrom
build/stricter-verify
Oct 16, 2026
Merged

oryan-block merged 9 commits into
masterfrom
build/stricter-verify

Conversation

@oryan-block

@oryan-block oryan-block commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Unblocks #809

Checklist

  • Pull requests follows the contribution guide
  • New or modified functionality is covered by tests

Description

A few mistakes only showed up after they were merged. Sonar flagged deprecated calls in #834, the Kotlin 2.4 update (#809) broke on a warning we've had for a while, and 6f78f35 had to fix a graphql-java 26 only API we started using. This makes mvn verify and the PR checks catch these instead.

Compiler warnings fail the build now (-Werror for kotlinc, failOnWarning for javac). javac also uses <release>11</release> instead of source/target.

To get there I fixed all 42 existing warnings (23 main, 19 test). Most are mechanical: Kotlin class literals instead of java.lang.Object/java.util.Map, a redundant cast, casts in tests. The ones worth a look:

  • module-info now has requires static org.jspecify. graphql-java's @Nullable annotations weren't readable from our module, which Kotlin 2.3 warns about ("Type annotation class 'Nullable' of the inferred type is inaccessible", KT-80247) and 2.4 turns into an error. That's what breaks Update kotlin #809. This branch builds and passes with Kotlin 2.4.21 and coroutines 1.11.0, the versions in Update kotlin #809.
  • introspectionEnabled(false) uses BlockedFields.newBlock().addPattern("__.*") instead of the deprecated NoIntrospectionGraphqlFieldVisibility, which is exactly what that class does internally. The replacement graphql-java suggests, Introspection.enabledJvmWide, is JVM-wide so it doesn't work for a per-schema option. Nothing tested this option so I added IntrospectionTest, which passes on master too.
  • SchemaParserOptions.build() and defaultOptions() aren't marked @ExperimentalCoroutinesApi anymore. Nothing in them is experimental, and Kotlin callers had to opt in just to build options. Removing the marker doesn't break source or binary compatibility. The tests that opted in for it don't anymore.
  • The legacy directive builder keeps using the deprecated argument value methods, with a @Suppress (it already has a TODO to go away).
  • MethodFieldResolver doesn't use a safe call on environment.graphQLSchema anymore. graphql-java marks it non-null and always sets it, it was only null in the environments MethodFieldResolverDataFetcherTest builds by hand, so those get a schema now. Check for scalar arguments when building the schema instead of on every request #859 would drop the lookup altogether.

A new PR job, graphql-java-25, runs verify against graphql-java 25.1, the oldest version we support. It would've caught what 6f78f35 fixed. It isn't a required check yet. The build (...) job names didn't change so branch protection still matches. If it looks fine we can make it required.

mvn verify passes on graphql-java 26.1 and 25.1.

Heads up for the open PRs: nothing conflicts, but once this is merged #842 has 2 warnings (Object::class.java and java.util.Map::class.java in SchemaClassScanner) and #843 has 12 (deprecated legacy directive calls in DirectiveTest). #838 is fine.

🤖 Generated with Claude Code

oryan-block and others added 4 commits October 12, 2026 15:01
- Require org.jspecify (static) in module-info. graphql-java's @nullable
  annotations were unreadable from the module, which Kotlin 2.4 turns
  into an error (KT-80247). This is what broke the Kotlin 2.4 update.
- Hide introspection with BlockedFields instead of the deprecated
  NoIntrospectionGraphqlFieldVisibility, which does the same thing. Its
  suggested replacement, Introspection.enabledJvmWide, is JVM-wide.
- Drop @ExperimentalCoroutinesApi from SchemaParserOptions.build() and
  defaultOptions(). Nothing in them is experimental anymore, and Kotlin
  callers no longer need to opt in.
- Suppress the deprecation on the legacy directive argument values and
  the safe call on the schema, which is null in hand-built environments.
- Use Kotlin class literals and drop a redundant cast; fix test warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pass -Werror to kotlinc and failOnWarning to javac, so warnings show up
in mvn verify instead of later in Sonar or a dependency update. javac
now uses release 11, which also drops its "location of system modules"
warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quests

- graphql-java-25: builds and tests against graphql-java 25.1, the
  oldest version this jar supports, e.g. to catch APIs that only exist
  in 26 like Directives.BUILT_IN_DIRECTIVES_MAP (6f78f35).
- release-bundle: builds the Maven Central bundle with the release
  profile and Maven 3.9, like the release workflow, without uploading
  it. It fails if the bundle has files Central rejects (e.g.
  maven-metadata-local.xml under Maven 3.10) or is missing the pom, jar,
  sources or javadoc jar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing covered introspectionEnabled(false), which now uses BlockedFields
directly. The same test passes on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It pins the same Maven as the release workflow, so it can't catch the Maven 3.10 problem it was added for. What's left (javadoc errors, a missing sources or javadoc jar) is rare and fails the release before anything is published or tagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oryan-block and others added 3 commits October 16, 2026 16:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SchemaParserOptions.build() isn't experimental anymore, so the tests don't need to opt in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
graphql-java always sets the schema on the environment, so the safe call on it was only there for this test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@oryan-block
oryan-block merged commit 55b4d19 into master Oct 16, 2026
7 checks passed
@oryan-block
oryan-block deleted the build/stricter-verify branch October 16, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant