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

java (dotnet?): arrays in CFN layer are always List<Object> #5067

Closed
eladb opened this issue Nov 17, 2019 · 6 comments
Closed

java (dotnet?): arrays in CFN layer are always List<Object> #5067

eladb opened this issue Nov 17, 2019 · 6 comments
Assignees
Labels
bug This issue is a bug.

Comments

@eladb
Copy link
Contributor

eladb commented Nov 17, 2019

The type of subscription should be List<CfnTopic.SubscriptionProperty> but instead it is List<Object>.

Screen Shot 2019-11-17 at 9 33 47

Reproduction Steps

CfnTopic.Builder.create(this, "YourTopic").subscription(...)

Environment

  • Framework Version: 1.16.3.DEVPREVIEW
  • Language : Java (& .NET?)
@eladb eladb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 17, 2019
@RomainMuller
Copy link
Contributor

The property is typed (in TypeScript) as:

Array<SubscriptionProperty | IResolvable> | IResolvable

The List<Object> java signature is actually the best that can be emitted for this... :(

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Nov 18, 2019
@eladb
Copy link
Contributor Author

eladb commented Nov 18, 2019

Why we can't generate the following overloads?

subscription(List<Object> subscription)
subscription(IResolvable subscription)
subscription(List<SubscriptionProperty> subscription)
subscription(List<IResolvable> subscription)

@RomainMuller
Copy link
Contributor

No we cannot - List<Object>, List<SubscriptionProperty>, and List<IResolvable> are all reified to List once compiled, so the java dispatcher wouldn't be able to effectively differentiate them (to schematize heavily - one could understand Java generics information is "lost" during compilation).

@eladb
Copy link
Contributor Author

eladb commented Nov 21, 2019

I am wondering if we should sacrifice List<IResolvable> and List<Object> in favor of List<Type> which is the common case and will have a dramatic improvement over the current t state. The other cases could be addressed through escape hatches easily.

@RomainMuller
Copy link
Contributor

The only way you can get List<IResolvable> sacrificed is by removing the option from the TS code, which would result in a breaking change.

@RomainMuller
Copy link
Contributor

Since this is now in the v2.0 issue, resolving this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants