fix(jsii-pacmak): toString() on anonymous classes does not call JavaScript implementation#5027
Merged
mergify[bot] merged 9 commits intomainfrom Jan 23, 2026
Merged
Conversation
…mplementation In recent changes, it looks like we dropped the implementation of `toString()` from a `Jsii$Default` interface (and didn't pick it up anywhere else), which means that `toString()` falls back to the Java implementation instead of the JavaScript one. This is only a problem in Java because only there is there also a default `toString()` implementation on all objects. Fix that and add a test for this behavior.
mrgrain
approved these changes
Jan 23, 2026
Contributor
|
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Contributor
|
Merging (with squash)... |
Contributor
Merge Queue Status✅ The pull request has been merged at 5093c3e This pull request spent 9 seconds in the queue, with no time running CI. Required conditions to merge
|
1 task
mergify bot
pushed a commit
to aws/aws-cdk
that referenced
this pull request
Feb 3, 2026
…java (#36843) ### Issue # (if applicable) Closes #36832 ### Reason for this change To fix the bug mentioned in the issue... ### Description of changes Bump the version `jsii-pacmak` to pull in the [jsii fix](aws/jsii#5027). ### Describe any new or updated permissions being added None ### Description of how you validated changes No code changes. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
ozelalisen
pushed a commit
to aws/aws-cdk
that referenced
this pull request
Feb 3, 2026
…java (#36843) ### Issue # (if applicable) Closes #36832 ### Reason for this change To fix the bug mentioned in the issue... ### Description of changes Bump the version `jsii-pacmak` to pull in the [jsii fix](aws/jsii#5027). ### Describe any new or updated permissions being added None ### Description of how you validated changes No code changes. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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.
In recent changes, we dropped as many methods from
Jsii$Proxyas possible. This includes the implementation oftoString()fromJsii$Proxy, which means thattoString()falls back to the Java implementation instead of the JavaScript one.This doesn't fail because only there is there also a default
toString()implementation on all objects in Java.There was no problem when we called
toString()on a proxy of a public JSII class, but in case we were using a pure interface proxy (when the concrete class was private or even anonymous), we wouldn't forward to the JavaScript-sidetoString()but call the default Java implementation instead.Fix that and add a test for this behavior.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.