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 (jsii): passing "null" behaves differently than no argument #157

Closed
eladb opened this issue Jun 21, 2018 · 3 comments
Closed

Java (jsii): passing "null" behaves differently than no argument #157

eladb opened this issue Jun 21, 2018 · 3 comments
Assignees
Labels
language/java Related to Java bindings

Comments

@eladb
Copy link
Contributor

eladb commented Jun 21, 2018

For example:

// no exception
new Queue(stack, "foo");

// exception: org.jsii.JsiiException: Cannot read property 'deliveryDelaySec' of null
new Queue(stack, "foo", null);

// workaround:
new Queue(stack, "foo", QueueProps.builder().build());
@RomainMuller
Copy link
Contributor

I guess the issue stems from the fact that the Java runtime passes null and not undefined, so the default argument value from JS is not triggered (only gets used if no value is passed or a literal undefined is passed).

@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 17, 2018

Is this still an issue?

@eladb
Copy link
Contributor Author

eladb commented Sep 17, 2018

I think it is

@debora-ito debora-ito added the language/java Related to Java bindings label Oct 31, 2018
@eladb eladb self-assigned this Nov 7, 2018
eladb pushed a commit to aws/jsii that referenced this issue Nov 7, 2018
Since most languages do not have a distinction between "null" and
"undefined", jsii will effectively convert any "null" value passed into
an argument, a property or inside an object to "undefined".

Adds a compliance test to Java and .NET called "NullShouldBeTreatedAsUndefined".

Fixes aws/aws-cdk#157
Fixes #282
eladb pushed a commit to aws/jsii that referenced this issue Nov 7, 2018
Since most languages do not have a distinction between "null" and
"undefined", jsii will effectively convert any "null" value passed into
an argument, a property or inside an object to "undefined".

Adds a compliance test to Java and .NET called "NullShouldBeTreatedAsUndefined".

Fixes aws/aws-cdk#157
Fixes #282
eladb pushed a commit to aws/jsii that referenced this issue Nov 7, 2018
Since most languages do not have a distinction between "null" and
"undefined", jsii will effectively convert any "null" value passed into
an argument, a property or inside an object to "undefined".

Adds a compliance test to Java and .NET called "NullShouldBeTreatedAsUndefined".

Fixes aws/aws-cdk#157
Fixes #282
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/java Related to Java bindings
Projects
None yet
Development

No branches or pull requests

4 participants