Do not generate certain interface mixin forwarders if not necessary #23674
+38
−1
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.
Fixes #21177
This affects indirectly extended java interfaces, bringing the behavior closer to how scala 2 handles it. After this commit, the methods from those interfaces will not be generated, if they are unnecessary (e.g., where there is no conflict between parents when calling that method) even if
-Xmixin-force-forwarders
is set to true. Those previously added mixin forwarders caused meant that since specific parents were referenced in those methods, they had to be added to theinterfaces
array in the generated classfile (without being added to the signature, which caused an issue with getInterfaces and getGenericInterfaces not being equal).Alternative solution would be to keep the mixing forwarder generation as it was, but change the signature generation in the GenBCode phase, but:
a) the current solution is how scala 2 does it
b) While I am not sure which solution is better in terms of binary compatibility, I feel like changing the signature would be worse
Also I copied one test from scala 2 codebase to make sure that we indeed generate the mixin forwarder if we actually need to