Repository navigation
Conversation
…T> compile 1014d98 casts `return Optional.empty();` into an `Optional<T>` as `(Optional.empty() as Optional<T>)`, and `Optional.of(value)` likewise; kotlinc cannot infer T from a cast, and Kotlin's Optional.of takes a non-null T. Now: `(Optional.empty<T>() as Optional<T>)` and `(Optional.of(value!!) as Optional<T>)`; the `!!` changes nothing, Java's Optional.of(null) throws too (reported as ASSERT_AT_DEREFERENCE). Test: TestJavaToKotlinStructure.optionalEmptyAndOfIntoTypeVariable (output compiles with kotlinc). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tom Tourwe <Tom.Tourwe@codelaser.io>
Contributor
|
Thanks. Devel had already fixed this independently in another form (ba7a889, the The whole batch (#146–#155) passes the Kotlin, C#, printer, front-end, inspection and bytecode suites on JDK 26 and JDK 27. It goes into 🤖 Generated with Claude Code |
bnaudts
pushed a commit
that referenced
this pull request
Oct 20, 2026
…tatic method reference returned as a Function The tests of #148 and #149. Their fixes were already on devel in another form (ba7a889 and the method-reference SAM constructor in assigned()); the tests pass without them and stay as regression tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
1014d98 casts
return Optional.empty();into anOptional<T>as(Optional.empty() as Optional<T>), andOptional.of(value)likewise; kotlinc cannot infer Tfrom a cast, and Kotlin's Optional.of takes a non-null T.
Now:
(Optional.empty<T>() as Optional<T>)and(Optional.of(value!!) as Optional<T>); the!!changes nothing, Java's Optional.of(null) throws too (reported as ASSERT_AT_DEREFERENCE).
Test: TestJavaToKotlinStructure.optionalEmptyAndOfIntoTypeVariable (output compiles with kotlinc).
How it was found
A mutation-testing run (PIT) over the lines that maddi's latest 100 commits changed listed the changed code no
existing test checks. Tests written for those lines, from what each commit says the code should do, exposed this
bug in the lines 1014d98 changed, which lists
emptyandofbut handled onlyofNullable.Tests
On
devel07b926b: the new test fails without the fix and passes with it.With this fix and the nine others of this series applied together, every maddi test passes
(run on 7bc974b: 2,743 tests, 0 failures).
🤖 Generated with Claude Code