-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii): use base interfaces for 'datatype' property (#265)
If an interface inherits from a non-datatype interface, it should no longer be classified as a datatype interface itself. Making this change requires that information about the base classes has already been determined, so I introduced an ordering mechanism for 'deferred's. Fixes #264.
- Loading branch information
Showing
12 changed files
with
483 additions
and
36 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
18 changes: 18 additions & 0 deletions
18
...torPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceThatShouldNotBeADataType.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,18 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <summary> | ||
/// Even though this interface has only properties, it is disqualified from being a datatype | ||
/// because it inherits from an interface that is not a datatype. | ||
/// </summary> | ||
[JsiiInterface(typeof(IIInterfaceThatShouldNotBeADataType), "jsii-calc.IInterfaceThatShouldNotBeADataType")] | ||
public interface IIInterfaceThatShouldNotBeADataType : IIInterfaceWithMethods | ||
{ | ||
[JsiiProperty("otherValue", "{\"primitive\":\"string\"}")] | ||
string OtherValue | ||
{ | ||
get; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithMethods.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,17 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
[JsiiInterface(typeof(IIInterfaceWithMethods), "jsii-calc.IInterfaceWithMethods")] | ||
public interface IIInterfaceWithMethods | ||
{ | ||
[JsiiProperty("value", "{\"primitive\":\"string\"}")] | ||
string Value | ||
{ | ||
get; | ||
} | ||
|
||
[JsiiMethod("doThings", null, "[]")] | ||
void DoThings(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceThatShouldNotBeADataTypeProxy.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,34 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <summary> | ||
/// Even though this interface has only properties, it is disqualified from being a datatype | ||
/// because it inherits from an interface that is not a datatype. | ||
/// </summary> | ||
[JsiiTypeProxy(typeof(IIInterfaceThatShouldNotBeADataType), "jsii-calc.IInterfaceThatShouldNotBeADataType")] | ||
internal sealed class IInterfaceThatShouldNotBeADataTypeProxy : DeputyBase, IIInterfaceThatShouldNotBeADataType | ||
{ | ||
private IInterfaceThatShouldNotBeADataTypeProxy(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
[JsiiProperty("otherValue", "{\"primitive\":\"string\"}")] | ||
public string OtherValue | ||
{ | ||
get => GetInstanceProperty<string>(); | ||
} | ||
|
||
[JsiiProperty("value", "{\"primitive\":\"string\"}")] | ||
public string Value | ||
{ | ||
get => GetInstanceProperty<string>(); | ||
} | ||
|
||
[JsiiMethod("doThings", null, "[]")] | ||
public void DoThings() | ||
{ | ||
InvokeInstanceVoidMethod(new object[]{}); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...s.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithMethodsProxy.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 | ||
{ | ||
[JsiiTypeProxy(typeof(IIInterfaceWithMethods), "jsii-calc.IInterfaceWithMethods")] | ||
internal sealed class IInterfaceWithMethodsProxy : DeputyBase, IIInterfaceWithMethods | ||
{ | ||
private IInterfaceWithMethodsProxy(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
[JsiiProperty("value", "{\"primitive\":\"string\"}")] | ||
public string Value | ||
{ | ||
get => GetInstanceProperty<string>(); | ||
} | ||
|
||
[JsiiMethod("doThings", null, "[]")] | ||
public void DoThings() | ||
{ | ||
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
34 changes: 34 additions & 0 deletions
34
...c/main/java/software/amazon/jsii/tests/calculator/IInterfaceThatShouldNotBeADataType.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,34 @@ | ||
package software.amazon.jsii.tests.calculator; | ||
|
||
/** | ||
* Even though this interface has only properties, it is disqualified from being a datatype | ||
* because it inherits from an interface that is not a datatype. | ||
*/ | ||
@javax.annotation.Generated(value = "jsii-pacmak") | ||
public interface IInterfaceThatShouldNotBeADataType extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.IInterfaceWithMethods { | ||
java.lang.String getOtherValue(); | ||
|
||
/** | ||
* A proxy class which represents a concrete javascript instance of this type. | ||
*/ | ||
final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceThatShouldNotBeADataType { | ||
protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
|
||
@Override | ||
public java.lang.String getOtherValue() { | ||
return this.jsiiGet("otherValue", java.lang.String.class); | ||
} | ||
|
||
@Override | ||
public java.lang.String getValue() { | ||
return this.jsiiGet("value", java.lang.String.class); | ||
} | ||
|
||
@Override | ||
public void doThings() { | ||
this.jsiiCall("doThings", Void.class); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithMethods.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,26 @@ | ||
package software.amazon.jsii.tests.calculator; | ||
|
||
@javax.annotation.Generated(value = "jsii-pacmak") | ||
public interface IInterfaceWithMethods extends software.amazon.jsii.JsiiSerializable { | ||
java.lang.String getValue(); | ||
void doThings(); | ||
|
||
/** | ||
* A proxy class which represents a concrete javascript instance of this type. | ||
*/ | ||
final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithMethods { | ||
protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
|
||
@Override | ||
public java.lang.String getValue() { | ||
return this.jsiiGet("value", java.lang.String.class); | ||
} | ||
|
||
@Override | ||
public void doThings() { | ||
this.jsiiCall("doThings", Void.class); | ||
} | ||
} | ||
} |
Oops, something went wrong.