-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dotnet): Correctly handle 'void' callback results (#471)
Previously, it attempted to generate an OptionalValue instance with no `Type`, which is illegal.
- Loading branch information
1 parent
7c6eeac
commit 81e41bd
Showing
18 changed files
with
357 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
41 changes: 41 additions & 0 deletions
41
...azon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallback.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <summary>This test is used to validate the runtimes can return correctly from a void callback.</summary> | ||
/// <remarks> | ||
/// - Implement `overrideMe` (method does not have to do anything). | ||
/// - Invoke `callMe` | ||
/// - Verify that `methodWasCalled` is `true`. | ||
/// </remarks> | ||
[JsiiClass(nativeType: typeof(VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] | ||
public abstract class VoidCallback : DeputyBase | ||
{ | ||
protected VoidCallback(): base(new DeputyProps(new object[]{})) | ||
{ | ||
} | ||
|
||
protected VoidCallback(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
protected VoidCallback(DeputyProps props): base(props) | ||
{ | ||
} | ||
|
||
[JsiiProperty(name: "methodWasCalled", typeJson: "{\"primitive\":\"boolean\"}")] | ||
public virtual bool MethodWasCalled | ||
{ | ||
get => GetInstanceProperty<bool>(); | ||
} | ||
|
||
[JsiiMethod(name: "callMe")] | ||
public virtual void CallMe() | ||
{ | ||
InvokeInstanceVoidMethod(new object[]{}); | ||
} | ||
|
||
[JsiiMethod(name: "overrideMe")] | ||
protected abstract void OverrideMe(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/VoidCallbackProxy.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <summary>This test is used to validate the runtimes can return correctly from a void callback.</summary> | ||
/// <remarks> | ||
/// - Implement `overrideMe` (method does not have to do anything). | ||
/// - Invoke `callMe` | ||
/// - Verify that `methodWasCalled` is `true`. | ||
/// </remarks> | ||
[JsiiTypeProxy(nativeType: typeof(VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] | ||
internal sealed class VoidCallbackProxy : VoidCallback | ||
{ | ||
private VoidCallbackProxy(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
[JsiiMethod(name: "overrideMe")] | ||
protected override void OverrideMe() | ||
{ | ||
InvokeInstanceVoidMethod(new object[]{}); | ||
} | ||
} | ||
} |
This file contains 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
44 changes: 44 additions & 0 deletions
44
...cted.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/VoidCallback.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package software.amazon.jsii.tests.calculator; | ||
|
||
/** | ||
* This test is used to validate the runtimes can return correctly from a void callback. | ||
* | ||
* - Implement `overrideMe` (method does not have to do anything). | ||
* - Invoke `callMe` | ||
* - Verify that `methodWasCalled` is `true`. | ||
*/ | ||
@javax.annotation.Generated(value = "jsii-pacmak") | ||
@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.VoidCallback") | ||
public abstract class VoidCallback extends software.amazon.jsii.JsiiObject { | ||
protected VoidCallback(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
public VoidCallback() { | ||
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); | ||
} | ||
|
||
public void callMe() { | ||
this.jsiiCall("callMe", Void.class); | ||
} | ||
|
||
protected abstract void overrideMe(); | ||
|
||
public java.lang.Boolean getMethodWasCalled() { | ||
return this.jsiiGet("methodWasCalled", java.lang.Boolean.class); | ||
} | ||
|
||
/** | ||
* A proxy class which represents a concrete javascript instance of this type. | ||
*/ | ||
final static class Jsii$Proxy extends software.amazon.jsii.tests.calculator.VoidCallback { | ||
protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
|
||
@Override | ||
protected void overrideMe() { | ||
this.jsiiCall("overrideMe", Void.class); | ||
} | ||
} | ||
} |
This file contains 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
Oops, something went wrong.