Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jnigen] Fix crash on Kotlin wildcards #1881

Merged
merged 3 commits into from
Jan 13, 2025
Merged

[jnigen] Fix crash on Kotlin wildcards #1881

merged 3 commits into from
Jan 13, 2025

Conversation

HosseinYousefi
Copy link
Member

Kotlin wildcards (*) would cause the code generator to crash. Now I represent them in the type arg list as null.

Copy link

github-actions bot commented Jan 10, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@coveralls
Copy link

coveralls commented Jan 10, 2025

Coverage Status

coverage: 87.723% (-0.005%) from 87.728%
when pulling 6f5a242 on fix-kotlin-type
into a7fb6ee on main.

@@ -1120,7 +1123,9 @@ class KotlinType implements Element<KotlinType> {
final String kind;
final String? name;
final int id;
final List<KotlinTypeProjection> arguments;

/// `null` represents a wildcard.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add an AST element for wildcards, rather than using null to represent it? If wildcards are only permitted in this arguments field, you could add a KotlinTypeArgument class that can be either a wildcard or a KotlinTypeProjection. That would be more self documenting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this from a JSON and use json_serializable to autogenerate the deserialization. I could do a custom thing for this one class though.

@HosseinYousefi HosseinYousefi merged commit bd486f6 into main Jan 13, 2025
27 checks passed
@HosseinYousefi HosseinYousefi deleted the fix-kotlin-type branch January 13, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants