Kotlin: minimize the usage of 'JvmSuppressWildcards'#1793
Merged
pwrobeldev merged 7 commits intomasterfrom Jan 26, 2026
Merged
Conversation
The annotation was used for each parameter type of collections. This was not needed. The annotation only needs to be used for open types which are: - open classes - interfaces - lambdas (generated as fun interfaces in Kotlin) Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Hsilgos
previously approved these changes
Jan 22, 2026
Add test cases that pass. Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The new test experiences compilation error because of missing
'JvmSuppressWildcards'.
```
gluecodium/functional-tests/functional/android/src/test/java/com/here/android/test/KotlinInteropTest.java:82:
error: incompatible types: List<CAP#1> cannot be converted to List<SomeDummyEnum>
assertEquals(0, someJavaFunctionThatTakesListOfEnums(someStruct.enumList));
^
where CAP#1 is a fresh type-variable:
CAP#1 extends SomeDummyEnum from capture of ? extends SomeDummyEnum
```
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Hsilgos
approved these changes
Jan 26, 2026
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.
---------- Motivation ----------
The annotation mentioned in the title of the commit was used
for parameter types of collections (List, Map, Set) to avoid
interoperability problems when the generated code is accessed
from Java.
The problematic case is checked in
KotlinInteropTest.java.However, it turns out that the mentioned annotation needs to be
only used for enums and open types, because if the type is final
then wildcard is not generated.
---------- Solution ----------
KotlinNameResolver class is adjusted to generate the annotation for
parameter type of collection only when it is enum or the type is open.
Smoke tests are adjusted to showcase that this change minimizes the
usage of 'JvmSuppressWildcards' annotation.
The functional test called 'KotlinInteropTest.java' passes without problems after the change.