Fix ClassCastException in cql-to-elm-cli with modelinfo#1805
Open
dehall wants to merge 3 commits into
Open
Conversation
Author
|
Apologies, I'm pretty sure the CI is all failing because this PR comes from a fork but I'm not sure what to do about it. I'm open to suggestions |
antvaset
approved these changes
Jul 12, 2026
Contributor
|
@dehall Looks good to me 👍 The PR only needs another approval and then it can be merged. |
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.
This PR fixes #1803 - a ClassCastException when running the CLI and specifying a modelinfo.
The short explanation is that in Kotlin, unlike Java, anonymous lambdas cannot be cast to interfaces unless they are explicitly marked as functional interfaces (
fun interface). So an alternative fix would be to markModelInfoProvideras a functional interface, but that may have broader implications. This approach instead creates an anonymous class that explicitly implements the interface.To test this, run the cli and specify a modelinfo, eg here's an example with files already in the repo: