Repository navigation
Remove InvalidSchemaError and the antlr4-runtime dependency - #927
Merged
Merged
Conversation
graphql-java shades antlr, so its parser never throws the unshaded ParseCancellationException that parseDocuments caught. The catch, and the InvalidSchemaError it would have thrown, were dead code, and they were the only reason tools depended on antlr4-runtime.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Checklist
Description
SchemaParserBuilder#parseDocumentscaught antlr'sParseCancellationExceptionand rethrew it asInvalidSchemaError. That catch hasn't been able to fire since graphql-java 19, which shades antlr intographql.org.antlr.v4.runtime. The parser only throws the relocated classes, so a catch onorg.antlr.v4.runtimenever matches. The catch was also the only reason we depended onantlr4-runtime, so this removes the catch,InvalidSchemaError, the dependency and therequiresinmodule-info.java.The antlr rule in
renovate.jsonis dropped separately in #924.Verified:
org/antlr/v4/runtime. 281 reference the shaded packageschemaString(...).build(), alone and with a second source. Everything came out asInvalidSyntaxException,SchemaSyntaxExceptionor graphql-java's ownParseCancelled*Exception. NeverInvalidSchemaErroror an unshaded antlr classmvn clean verify: 421 tests, 0 failures.dependency:treehas noorg.antlr.graphqlsloaded through.file(...)still fails withSchemaSyntaxException: Invalid syntax with offending token '!' at line 3 column 11 in scenarios/syntax-error/schema.graphqls. Thebookstorescenario builds and runs with no errors. The installed pom has no antlrRelease note:
InvalidSchemaErroris removed in 15.0.0. Nothing has thrown it since graphql-java 19, so acatchfor it can just be deleted. graphql-java-tools no longer brings inorg.antlr:antlr4-runtime, so an app that uses antlr directly needs to declare it.