From 2c9e1f98d1ee0f5bf0fbdae0d6d2ed69e4cc3cc4 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 22 Oct 2018 15:44:48 +0200 Subject: [PATCH] fix: match behavioral interface to 'I'-prefix This change incorporates two fixes that will make the tagging of interfaces as datatypes more correct going forward: - If a datatype candidate interface is named with an I-prefix (such as IConnectable), it will no longer be considered a datatype interface, regardless of whether it would qualify as one. - If an interface contains behavior (is definitely not a datatype interface) then the name must start with an I as well. --- packages/jsii-calc/lib/compliance.ts | 16 +- packages/jsii-calc/test/assembly.jsii | 188 ++++++++-------- .../ComplianceTests.cs | 2 +- .../amazon/jsii/testing/ComplianceTest.java | 6 +- .../.jsii | 188 ++++++++-------- ...rivateConstructorAndAutomaticProperties.cs | 2 +- ...IIInterfaceWithOptionalMethodArguments.cs} | 4 +- .../IIInterfaceWithPropertiesExtension.cs | 15 -- .../{IReturnsNumber.cs => IIReturnsNumber.cs} | 4 +- ...erfaceWithOptionalMethodArgumentsProxy.cs} | 6 +- .../IInterfaceWithProperties.cs | 11 +- .../IInterfaceWithPropertiesExtension.cs | 20 +- ...sNumberProxy.cs => IReturnsNumberProxy.cs} | 6 +- ...operties.cs => InterfaceWithProperties.cs} | 11 +- .../InterfaceWithPropertiesExtension.cs | 27 +++ ... InterfaceWithPropertiesExtensionProxy.cs} | 6 +- ...oxy.cs => InterfaceWithPropertiesProxy.cs} | 6 +- .../OverrideReturnsObject.cs | 4 +- .../UsesInterfaceWithProperties.cs | 14 +- .../amazon/jsii/tests/calculator/$Module.java | 8 +- ...vateConstructorAndAutomaticProperties.java | 2 +- ...InterfaceWithOptionalMethodArguments.java} | 4 +- ...ReturnsNumber.java => IReturnsNumber.java} | 4 +- ...ties.java => InterfaceWithProperties.java} | 14 +- ... => InterfaceWithPropertiesExtension.java} | 14 +- .../calculator/OverrideReturnsObject.java | 2 +- .../UsesInterfaceWithProperties.java | 8 +- .../expected.jsii-calc/sphinx/jsii-calc.rst | 202 +++++++++--------- packages/jsii/lib/assembler.ts | 26 ++- .../neg.behavior-requires-iprefix.ts | 8 + 30 files changed, 430 insertions(+), 398 deletions(-) rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{IInterfaceWithOptionalMethodArguments.cs => IIInterfaceWithOptionalMethodArguments.cs} (72%) delete mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{IReturnsNumber.cs => IIReturnsNumber.cs} (75%) rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{InterfaceWithOptionalMethodArgumentsProxy.cs => IInterfaceWithOptionalMethodArgumentsProxy.cs} (62%) rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{ReturnsNumberProxy.cs => IReturnsNumberProxy.cs} (68%) rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{IIInterfaceWithProperties.cs => InterfaceWithProperties.cs} (59%) create mode 100644 packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtension.cs rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{IInterfaceWithPropertiesExtensionProxy.cs => InterfaceWithPropertiesExtensionProxy.cs} (69%) rename packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/{IInterfaceWithPropertiesProxy.cs => InterfaceWithPropertiesProxy.cs} (65%) rename packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/{InterfaceWithOptionalMethodArguments.java => IInterfaceWithOptionalMethodArguments.java} (86%) rename packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/{ReturnsNumber.java => IReturnsNumber.java} (83%) rename packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/{IInterfaceWithProperties.java => InterfaceWithProperties.java} (86%) rename packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/{IInterfaceWithPropertiesExtension.java => InterfaceWithPropertiesExtension.java} (87%) create mode 100644 packages/jsii/test/negatives/neg.behavior-requires-iprefix.ts diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index b90576a6fc..c8ab84a415 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -520,17 +520,17 @@ export class GiveMeStructs { } } -export interface IInterfaceWithProperties { +export interface InterfaceWithProperties { readonly readOnlyString: string; readWriteString: string; } -export interface IInterfaceWithPropertiesExtension extends IInterfaceWithProperties { +export interface InterfaceWithPropertiesExtension extends InterfaceWithProperties { foo: number; } export class UsesInterfaceWithProperties { - constructor(public readonly obj: IInterfaceWithProperties) { + constructor(public readonly obj: InterfaceWithProperties) { } @@ -543,7 +543,7 @@ export class UsesInterfaceWithProperties { return this.obj.readWriteString; } - public readStringAndNumber(ext: IInterfaceWithPropertiesExtension) { + public readStringAndNumber(ext: InterfaceWithPropertiesExtension) { return `base=${ext.readOnlyString} child=${ext.foo} keys=[${Object.keys(ext).join(',')}]`; } } @@ -573,13 +573,13 @@ export class AllowedMethodNames { } } -export interface ReturnsNumber { +export interface IReturnsNumber { obtainNumber(): Number; readonly numberProp: Number; } export class OverrideReturnsObject { - public test(obj: ReturnsNumber) { + public test(obj: IReturnsNumber) { return obj.obtainNumber().doubleValue + obj.numberProp.doubleValue; } } @@ -832,7 +832,7 @@ export namespace InterfaceInNamespaceIncludesClasses { * awslabs/jsii#175 * Interface proxies (and builders) do not respect optional arguments in methods */ -export interface InterfaceWithOptionalMethodArguments { +export interface IInterfaceWithOptionalMethodArguments { hello(arg1: string, arg2?: number): void } @@ -918,7 +918,7 @@ export class DoNotOverridePrivates { /** * Class that implements interface properties automatically, but using a private constructor */ -export class ClassWithPrivateConstructorAndAutomaticProperties implements IInterfaceWithProperties { +export class ClassWithPrivateConstructorAndAutomaticProperties implements InterfaceWithProperties { public static create(readOnlyString: string, readWriteString: string) { return new ClassWithPrivateConstructorAndAutomaticProperties(readOnlyString, readWriteString); } diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index cca58d3622..bca9770d4f 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -1043,7 +1043,7 @@ "fqn": "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties", "interfaces": [ { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } ], "kind": "class", @@ -1076,7 +1076,7 @@ "immutable": true, "name": "readOnlyString", "overrides": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" }, "type": { "primitive": "string" @@ -1085,7 +1085,7 @@ { "name": "readWriteString", "overrides": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" }, "type": { "primitive": "string" @@ -1498,50 +1498,35 @@ } ] }, - "jsii-calc.IInterfaceWithProperties": { + "jsii-calc.IInterfaceWithOptionalMethodArguments": { "assembly": "jsii-calc", - "datatype": true, - "fqn": "jsii-calc.IInterfaceWithProperties", + "docs": { + "comment": "awslabs/jsii#175\nInterface proxies (and builders) do not respect optional arguments in methods" + }, + "fqn": "jsii-calc.IInterfaceWithOptionalMethodArguments", "kind": "interface", - "name": "IInterfaceWithProperties", - "properties": [ - { - "abstract": true, - "immutable": true, - "name": "readOnlyString", - "type": { - "primitive": "string" - } - }, + "methods": [ { "abstract": true, - "name": "readWriteString", - "type": { - "primitive": "string" - } - } - ] - }, - "jsii-calc.IInterfaceWithPropertiesExtension": { - "assembly": "jsii-calc", - "datatype": true, - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension", - "interfaces": [ - { - "fqn": "jsii-calc.IInterfaceWithProperties" + "name": "hello", + "parameters": [ + { + "name": "arg1", + "type": { + "primitive": "string" + } + }, + { + "name": "arg2", + "type": { + "optional": true, + "primitive": "number" + } + } + ] } ], - "kind": "interface", - "name": "IInterfaceWithPropertiesExtension", - "properties": [ - { - "abstract": true, - "name": "foo", - "type": { - "primitive": "number" - } - } - ] + "name": "IInterfaceWithOptionalMethodArguments" }, "jsii-calc.IRandomNumberGenerator": { "assembly": "jsii-calc", @@ -1565,6 +1550,31 @@ ], "name": "IRandomNumberGenerator" }, + "jsii-calc.IReturnsNumber": { + "assembly": "jsii-calc", + "fqn": "jsii-calc.IReturnsNumber", + "kind": "interface", + "methods": [ + { + "abstract": true, + "name": "obtainNumber", + "returns": { + "primitive": "number" + } + } + ], + "name": "IReturnsNumber", + "properties": [ + { + "abstract": true, + "immutable": true, + "name": "numberProp", + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.ImplictBaseOfBase": { "assembly": "jsii-calc", "datatype": true, @@ -1659,35 +1669,50 @@ } ] }, - "jsii-calc.InterfaceWithOptionalMethodArguments": { + "jsii-calc.InterfaceWithProperties": { "assembly": "jsii-calc", - "docs": { - "comment": "awslabs/jsii#175\nInterface proxies (and builders) do not respect optional arguments in methods" - }, - "fqn": "jsii-calc.InterfaceWithOptionalMethodArguments", + "datatype": true, + "fqn": "jsii-calc.InterfaceWithProperties", "kind": "interface", - "methods": [ + "name": "InterfaceWithProperties", + "properties": [ { "abstract": true, - "name": "hello", - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "optional": true, - "primitive": "number" - } - } - ] + "immutable": true, + "name": "readOnlyString", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "name": "readWriteString", + "type": { + "primitive": "string" + } + } + ] + }, + "jsii-calc.InterfaceWithPropertiesExtension": { + "assembly": "jsii-calc", + "datatype": true, + "fqn": "jsii-calc.InterfaceWithPropertiesExtension", + "interfaces": [ + { + "fqn": "jsii-calc.InterfaceWithProperties" } ], - "name": "InterfaceWithOptionalMethodArguments" + "kind": "interface", + "name": "InterfaceWithPropertiesExtension", + "properties": [ + { + "abstract": true, + "name": "foo", + "type": { + "primitive": "number" + } + } + ] }, "jsii-calc.JSObjectLiteralForInterface": { "assembly": "jsii-calc", @@ -2380,7 +2405,7 @@ { "name": "obj", "type": { - "fqn": "jsii-calc.ReturnsNumber" + "fqn": "jsii-calc.IReturnsNumber" } } ], @@ -2530,31 +2555,6 @@ } ] }, - "jsii-calc.ReturnsNumber": { - "assembly": "jsii-calc", - "fqn": "jsii-calc.ReturnsNumber", - "kind": "interface", - "methods": [ - { - "abstract": true, - "name": "obtainNumber", - "returns": { - "primitive": "number" - } - } - ], - "name": "ReturnsNumber", - "properties": [ - { - "abstract": true, - "immutable": true, - "name": "numberProp", - "type": { - "primitive": "number" - } - } - ] - }, "jsii-calc.RuntimeTypeChecking": { "assembly": "jsii-calc", "fqn": "jsii-calc.RuntimeTypeChecking", @@ -3087,7 +3087,7 @@ { "name": "obj", "type": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } } ] @@ -3106,7 +3106,7 @@ { "name": "ext", "type": { - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" + "fqn": "jsii-calc.InterfaceWithPropertiesExtension" } } ], @@ -3135,7 +3135,7 @@ "immutable": true, "name": "obj", "type": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } } ] @@ -3401,5 +3401,5 @@ } }, "version": "0.7.7", - "fingerprint": "vJH1gHlpRxKo77e0kE+6KATwgsZB0VpBcFEo/9OIG7Q=" + "fingerprint": "ztjwo/sf4owA37SlePL0icwoE4gA3UJyvQ2Zl89FSco=" } diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs index a628c003b1..c8f176986f 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs @@ -493,7 +493,7 @@ public override string TheProperty } } - class InterfaceWithProperties : DeputyBase, IIInterfaceWithProperties + class InterfaceWithProperties : DeputyBase, IInterfaceWithProperties { string _x; diff --git a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java index 4415c88d5e..43aef436d1 100644 --- a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java +++ b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java @@ -16,7 +16,7 @@ import software.amazon.jsii.tests.calculator.GiveMeStructs; import software.amazon.jsii.tests.calculator.IFriendlier; import software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator; -import software.amazon.jsii.tests.calculator.IInterfaceWithProperties; +import software.amazon.jsii.tests.calculator.InterfaceWithProperties; import software.amazon.jsii.tests.calculator.IRandomNumberGenerator; import software.amazon.jsii.tests.calculator.InterfaceImplementedByAbstractClass; import software.amazon.jsii.tests.calculator.JSObjectLiteralForInterface; @@ -555,7 +555,7 @@ public void setTheProperty(String value) { @Test public void propertyOverrides_interfaces() { - IInterfaceWithProperties obj = new IInterfaceWithProperties() { + InterfaceWithProperties obj = new InterfaceWithProperties() { private String x; @Override @@ -581,7 +581,7 @@ public void setReadWriteString(String value) { @Test public void interfaceBuilder() { - IInterfaceWithProperties obj = IInterfaceWithProperties.builder() + InterfaceWithProperties obj = InterfaceWithProperties.builder() .withReadOnlyString("READ_ONLY") .withReadWriteString("READ_WRITE") .build(); diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index cca58d3622..bca9770d4f 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -1043,7 +1043,7 @@ "fqn": "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties", "interfaces": [ { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } ], "kind": "class", @@ -1076,7 +1076,7 @@ "immutable": true, "name": "readOnlyString", "overrides": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" }, "type": { "primitive": "string" @@ -1085,7 +1085,7 @@ { "name": "readWriteString", "overrides": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" }, "type": { "primitive": "string" @@ -1498,50 +1498,35 @@ } ] }, - "jsii-calc.IInterfaceWithProperties": { + "jsii-calc.IInterfaceWithOptionalMethodArguments": { "assembly": "jsii-calc", - "datatype": true, - "fqn": "jsii-calc.IInterfaceWithProperties", + "docs": { + "comment": "awslabs/jsii#175\nInterface proxies (and builders) do not respect optional arguments in methods" + }, + "fqn": "jsii-calc.IInterfaceWithOptionalMethodArguments", "kind": "interface", - "name": "IInterfaceWithProperties", - "properties": [ - { - "abstract": true, - "immutable": true, - "name": "readOnlyString", - "type": { - "primitive": "string" - } - }, + "methods": [ { "abstract": true, - "name": "readWriteString", - "type": { - "primitive": "string" - } - } - ] - }, - "jsii-calc.IInterfaceWithPropertiesExtension": { - "assembly": "jsii-calc", - "datatype": true, - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension", - "interfaces": [ - { - "fqn": "jsii-calc.IInterfaceWithProperties" + "name": "hello", + "parameters": [ + { + "name": "arg1", + "type": { + "primitive": "string" + } + }, + { + "name": "arg2", + "type": { + "optional": true, + "primitive": "number" + } + } + ] } ], - "kind": "interface", - "name": "IInterfaceWithPropertiesExtension", - "properties": [ - { - "abstract": true, - "name": "foo", - "type": { - "primitive": "number" - } - } - ] + "name": "IInterfaceWithOptionalMethodArguments" }, "jsii-calc.IRandomNumberGenerator": { "assembly": "jsii-calc", @@ -1565,6 +1550,31 @@ ], "name": "IRandomNumberGenerator" }, + "jsii-calc.IReturnsNumber": { + "assembly": "jsii-calc", + "fqn": "jsii-calc.IReturnsNumber", + "kind": "interface", + "methods": [ + { + "abstract": true, + "name": "obtainNumber", + "returns": { + "primitive": "number" + } + } + ], + "name": "IReturnsNumber", + "properties": [ + { + "abstract": true, + "immutable": true, + "name": "numberProp", + "type": { + "primitive": "number" + } + } + ] + }, "jsii-calc.ImplictBaseOfBase": { "assembly": "jsii-calc", "datatype": true, @@ -1659,35 +1669,50 @@ } ] }, - "jsii-calc.InterfaceWithOptionalMethodArguments": { + "jsii-calc.InterfaceWithProperties": { "assembly": "jsii-calc", - "docs": { - "comment": "awslabs/jsii#175\nInterface proxies (and builders) do not respect optional arguments in methods" - }, - "fqn": "jsii-calc.InterfaceWithOptionalMethodArguments", + "datatype": true, + "fqn": "jsii-calc.InterfaceWithProperties", "kind": "interface", - "methods": [ + "name": "InterfaceWithProperties", + "properties": [ { "abstract": true, - "name": "hello", - "parameters": [ - { - "name": "arg1", - "type": { - "primitive": "string" - } - }, - { - "name": "arg2", - "type": { - "optional": true, - "primitive": "number" - } - } - ] + "immutable": true, + "name": "readOnlyString", + "type": { + "primitive": "string" + } + }, + { + "abstract": true, + "name": "readWriteString", + "type": { + "primitive": "string" + } + } + ] + }, + "jsii-calc.InterfaceWithPropertiesExtension": { + "assembly": "jsii-calc", + "datatype": true, + "fqn": "jsii-calc.InterfaceWithPropertiesExtension", + "interfaces": [ + { + "fqn": "jsii-calc.InterfaceWithProperties" } ], - "name": "InterfaceWithOptionalMethodArguments" + "kind": "interface", + "name": "InterfaceWithPropertiesExtension", + "properties": [ + { + "abstract": true, + "name": "foo", + "type": { + "primitive": "number" + } + } + ] }, "jsii-calc.JSObjectLiteralForInterface": { "assembly": "jsii-calc", @@ -2380,7 +2405,7 @@ { "name": "obj", "type": { - "fqn": "jsii-calc.ReturnsNumber" + "fqn": "jsii-calc.IReturnsNumber" } } ], @@ -2530,31 +2555,6 @@ } ] }, - "jsii-calc.ReturnsNumber": { - "assembly": "jsii-calc", - "fqn": "jsii-calc.ReturnsNumber", - "kind": "interface", - "methods": [ - { - "abstract": true, - "name": "obtainNumber", - "returns": { - "primitive": "number" - } - } - ], - "name": "ReturnsNumber", - "properties": [ - { - "abstract": true, - "immutable": true, - "name": "numberProp", - "type": { - "primitive": "number" - } - } - ] - }, "jsii-calc.RuntimeTypeChecking": { "assembly": "jsii-calc", "fqn": "jsii-calc.RuntimeTypeChecking", @@ -3087,7 +3087,7 @@ { "name": "obj", "type": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } } ] @@ -3106,7 +3106,7 @@ { "name": "ext", "type": { - "fqn": "jsii-calc.IInterfaceWithPropertiesExtension" + "fqn": "jsii-calc.InterfaceWithPropertiesExtension" } } ], @@ -3135,7 +3135,7 @@ "immutable": true, "name": "obj", "type": { - "fqn": "jsii-calc.IInterfaceWithProperties" + "fqn": "jsii-calc.InterfaceWithProperties" } } ] @@ -3401,5 +3401,5 @@ } }, "version": "0.7.7", - "fingerprint": "vJH1gHlpRxKo77e0kE+6KATwgsZB0VpBcFEo/9OIG7Q=" + "fingerprint": "ztjwo/sf4owA37SlePL0icwoE4gA3UJyvQ2Zl89FSco=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs index 2104096615..f1432dbc47 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithPrivateConstructorAndAutomaticProperties.cs @@ -4,7 +4,7 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Class that implements interface properties automatically, but using a private constructor [JsiiClass(typeof(ClassWithPrivateConstructorAndAutomaticProperties), "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties", "[]")] - public class ClassWithPrivateConstructorAndAutomaticProperties : DeputyBase, IIInterfaceWithProperties + public class ClassWithPrivateConstructorAndAutomaticProperties : DeputyBase, IInterfaceWithProperties { protected ClassWithPrivateConstructorAndAutomaticProperties(ByRefValue reference): base(reference) { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArguments.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs similarity index 72% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArguments.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs index c57ab841ae..efa7d04690 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArguments.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithOptionalMethodArguments.cs @@ -6,8 +6,8 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// awslabs/jsii#175 /// Interface proxies (and builders) do not respect optional arguments in methods /// - [JsiiInterface(typeof(IInterfaceWithOptionalMethodArguments), "jsii-calc.InterfaceWithOptionalMethodArguments")] - public interface IInterfaceWithOptionalMethodArguments + [JsiiInterface(typeof(IIInterfaceWithOptionalMethodArguments), "jsii-calc.IInterfaceWithOptionalMethodArguments")] + public interface IIInterfaceWithOptionalMethodArguments { [JsiiMethod("hello", null, "[{\"name\":\"arg1\",\"type\":{\"primitive\":\"string\"}},{\"name\":\"arg2\",\"type\":{\"primitive\":\"number\",\"optional\":true}}]")] void Hello(string arg1, double? arg2); diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs deleted file mode 100644 index 26840a4247..0000000000 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithPropertiesExtension.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Amazon.JSII.Runtime.Deputy; - -namespace Amazon.JSII.Tests.CalculatorNamespace -{ - [JsiiInterface(typeof(IIInterfaceWithPropertiesExtension), "jsii-calc.IInterfaceWithPropertiesExtension")] - public interface IIInterfaceWithPropertiesExtension : IIInterfaceWithProperties - { - [JsiiProperty("foo", "{\"primitive\":\"number\"}")] - double Foo - { - get; - set; - } - } -} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumber.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs similarity index 75% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumber.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs index bedb9be1cb..4c3ab80cc1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumber.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIReturnsNumber.cs @@ -2,8 +2,8 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiInterface(typeof(IReturnsNumber), "jsii-calc.ReturnsNumber")] - public interface IReturnsNumber + [JsiiInterface(typeof(IIReturnsNumber), "jsii-calc.IReturnsNumber")] + public interface IIReturnsNumber { [JsiiProperty("numberProp", "{\"primitive\":\"number\"}")] double NumberProp diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithOptionalMethodArgumentsProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs similarity index 62% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithOptionalMethodArgumentsProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs index bc3fc3c77e..27bd0fb927 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithOptionalMethodArgumentsProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithOptionalMethodArgumentsProxy.cs @@ -6,10 +6,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// awslabs/jsii#175 /// Interface proxies (and builders) do not respect optional arguments in methods /// - [JsiiTypeProxy(typeof(IInterfaceWithOptionalMethodArguments), "jsii-calc.InterfaceWithOptionalMethodArguments")] - internal sealed class InterfaceWithOptionalMethodArgumentsProxy : DeputyBase, IInterfaceWithOptionalMethodArguments + [JsiiTypeProxy(typeof(IIInterfaceWithOptionalMethodArguments), "jsii-calc.IInterfaceWithOptionalMethodArguments")] + internal sealed class IInterfaceWithOptionalMethodArgumentsProxy : DeputyBase, IIInterfaceWithOptionalMethodArguments { - private InterfaceWithOptionalMethodArgumentsProxy(ByRefValue reference): base(reference) + private IInterfaceWithOptionalMethodArgumentsProxy(ByRefValue reference): base(reference) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithProperties.cs index 68ba03b8f6..bdd8d663ba 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithProperties.cs @@ -2,16 +2,17 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - public class IInterfaceWithProperties : DeputyBase, IIInterfaceWithProperties + [JsiiInterface(typeof(IInterfaceWithProperties), "jsii-calc.InterfaceWithProperties")] + public interface IInterfaceWithProperties { - [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}", true)] - public string ReadOnlyString + [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}")] + string ReadOnlyString { get; } - [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}", true)] - public string ReadWriteString + [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}")] + string ReadWriteString { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtension.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtension.cs index 3a176e747b..10dbf0c3a1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtension.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtension.cs @@ -2,23 +2,11 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - public class IInterfaceWithPropertiesExtension : DeputyBase, IIInterfaceWithPropertiesExtension + [JsiiInterface(typeof(IInterfaceWithPropertiesExtension), "jsii-calc.InterfaceWithPropertiesExtension")] + public interface IInterfaceWithPropertiesExtension : IInterfaceWithProperties { - [JsiiProperty("foo", "{\"primitive\":\"number\"}", true)] - public double Foo - { - get; - set; - } - - [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}", true)] - public string ReadOnlyString - { - get; - } - - [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}", true)] - public string ReadWriteString + [JsiiProperty("foo", "{\"primitive\":\"number\"}")] + double Foo { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsNumberProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs similarity index 68% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsNumberProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs index f8fba91891..e77ef70356 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ReturnsNumberProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IReturnsNumberProxy.cs @@ -2,10 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiTypeProxy(typeof(IReturnsNumber), "jsii-calc.ReturnsNumber")] - internal sealed class ReturnsNumberProxy : DeputyBase, IReturnsNumber + [JsiiTypeProxy(typeof(IIReturnsNumber), "jsii-calc.IReturnsNumber")] + internal sealed class IReturnsNumberProxy : DeputyBase, IIReturnsNumber { - private ReturnsNumberProxy(ByRefValue reference): base(reference) + private IReturnsNumberProxy(ByRefValue reference): base(reference) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithProperties.cs similarity index 59% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithProperties.cs index cfdc3b488f..12c9b6f112 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IIInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithProperties.cs @@ -2,17 +2,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiInterface(typeof(IIInterfaceWithProperties), "jsii-calc.IInterfaceWithProperties")] - public interface IIInterfaceWithProperties + public class InterfaceWithProperties : DeputyBase, IInterfaceWithProperties { - [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}")] - string ReadOnlyString + [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}", true)] + public string ReadOnlyString { get; } - [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}")] - string ReadWriteString + [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}", true)] + public string ReadWriteString { get; set; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtension.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtension.cs new file mode 100644 index 0000000000..40e63b9932 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtension.cs @@ -0,0 +1,27 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + public class InterfaceWithPropertiesExtension : DeputyBase, IInterfaceWithPropertiesExtension + { + [JsiiProperty("foo", "{\"primitive\":\"number\"}", true)] + public double Foo + { + get; + set; + } + + [JsiiProperty("readOnlyString", "{\"primitive\":\"string\"}", true)] + public string ReadOnlyString + { + get; + } + + [JsiiProperty("readWriteString", "{\"primitive\":\"string\"}", true)] + public string ReadWriteString + { + get; + set; + } + } +} \ No newline at end of file diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtensionProxy.cs similarity index 69% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtensionProxy.cs index 805ef19457..554a0cd175 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesExtensionProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesExtensionProxy.cs @@ -2,10 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiTypeProxy(typeof(IIInterfaceWithPropertiesExtension), "jsii-calc.IInterfaceWithPropertiesExtension")] - internal sealed class IInterfaceWithPropertiesExtensionProxy : DeputyBase, IIInterfaceWithPropertiesExtension + [JsiiTypeProxy(typeof(IInterfaceWithPropertiesExtension), "jsii-calc.InterfaceWithPropertiesExtension")] + internal sealed class InterfaceWithPropertiesExtensionProxy : DeputyBase, IInterfaceWithPropertiesExtension { - private IInterfaceWithPropertiesExtensionProxy(ByRefValue reference): base(reference) + private InterfaceWithPropertiesExtensionProxy(ByRefValue reference): base(reference) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesProxy.cs similarity index 65% rename from packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs rename to packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesProxy.cs index c2afae727e..7f730ac4f4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IInterfaceWithPropertiesProxy.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/InterfaceWithPropertiesProxy.cs @@ -2,10 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiTypeProxy(typeof(IIInterfaceWithProperties), "jsii-calc.IInterfaceWithProperties")] - internal sealed class IInterfaceWithPropertiesProxy : DeputyBase, IIInterfaceWithProperties + [JsiiTypeProxy(typeof(IInterfaceWithProperties), "jsii-calc.InterfaceWithProperties")] + internal sealed class InterfaceWithPropertiesProxy : DeputyBase, IInterfaceWithProperties { - private IInterfaceWithPropertiesProxy(ByRefValue reference): base(reference) + private InterfaceWithPropertiesProxy(ByRefValue reference): base(reference) { } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs index 152f329b6d..ca6d3127ad 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OverrideReturnsObject.cs @@ -17,8 +17,8 @@ protected OverrideReturnsObject(DeputyProps props): base(props) { } - [JsiiMethod("test", "{\"primitive\":\"number\"}", "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.ReturnsNumber\"}}]")] - public virtual double Test(IReturnsNumber obj) + [JsiiMethod("test", "{\"primitive\":\"number\"}", "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IReturnsNumber\"}}]")] + public virtual double Test(IIReturnsNumber obj) { return InvokeInstanceMethod(new object[]{obj}); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs index 36b537a76c..a0c9daf896 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/UsesInterfaceWithProperties.cs @@ -2,10 +2,10 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { - [JsiiClass(typeof(UsesInterfaceWithProperties), "jsii-calc.UsesInterfaceWithProperties", "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}}]")] + [JsiiClass(typeof(UsesInterfaceWithProperties), "jsii-calc.UsesInterfaceWithProperties", "[{\"name\":\"obj\",\"type\":{\"fqn\":\"jsii-calc.InterfaceWithProperties\"}}]")] public class UsesInterfaceWithProperties : DeputyBase { - public UsesInterfaceWithProperties(IIInterfaceWithProperties obj): base(new DeputyProps(new object[]{obj})) + public UsesInterfaceWithProperties(IInterfaceWithProperties obj): base(new DeputyProps(new object[]{obj})) { } @@ -17,10 +17,10 @@ protected UsesInterfaceWithProperties(DeputyProps props): base(props) { } - [JsiiProperty("obj", "{\"fqn\":\"jsii-calc.IInterfaceWithProperties\"}")] - public virtual IIInterfaceWithProperties Obj + [JsiiProperty("obj", "{\"fqn\":\"jsii-calc.InterfaceWithProperties\"}")] + public virtual IInterfaceWithProperties Obj { - get => GetInstanceProperty(); + get => GetInstanceProperty(); } [JsiiMethod("justRead", "{\"primitive\":\"string\"}", "[]")] @@ -29,8 +29,8 @@ public virtual string JustRead() return InvokeInstanceMethod(new object[]{}); } - [JsiiMethod("readStringAndNumber", "{\"primitive\":\"string\"}", "[{\"name\":\"ext\",\"type\":{\"fqn\":\"jsii-calc.IInterfaceWithPropertiesExtension\"}}]")] - public virtual string ReadStringAndNumber(IIInterfaceWithPropertiesExtension ext) + [JsiiMethod("readStringAndNumber", "{\"primitive\":\"string\"}", "[{\"name\":\"ext\",\"type\":{\"fqn\":\"jsii-calc.InterfaceWithPropertiesExtension\"}}]")] + public virtual string ReadStringAndNumber(IInterfaceWithPropertiesExtension ext) { return InvokeInstanceMethod(new object[]{ext}); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java index aec0d95abc..f3ee9b1581 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java @@ -42,15 +42,16 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.IFriendlyRandomGenerator": return software.amazon.jsii.tests.calculator.IFriendlyRandomGenerator.class; case "jsii-calc.IInterfaceThatShouldNotBeADataType": return software.amazon.jsii.tests.calculator.IInterfaceThatShouldNotBeADataType.class; case "jsii-calc.IInterfaceWithMethods": return software.amazon.jsii.tests.calculator.IInterfaceWithMethods.class; - case "jsii-calc.IInterfaceWithProperties": return software.amazon.jsii.tests.calculator.IInterfaceWithProperties.class; - case "jsii-calc.IInterfaceWithPropertiesExtension": return software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension.class; + case "jsii-calc.IInterfaceWithOptionalMethodArguments": return software.amazon.jsii.tests.calculator.IInterfaceWithOptionalMethodArguments.class; case "jsii-calc.IRandomNumberGenerator": return software.amazon.jsii.tests.calculator.IRandomNumberGenerator.class; + case "jsii-calc.IReturnsNumber": return software.amazon.jsii.tests.calculator.IReturnsNumber.class; case "jsii-calc.ImplictBaseOfBase": return software.amazon.jsii.tests.calculator.ImplictBaseOfBase.class; case "jsii-calc.InterfaceImplementedByAbstractClass": return software.amazon.jsii.tests.calculator.InterfaceImplementedByAbstractClass.class; case "jsii-calc.InterfaceInNamespaceIncludesClasses.Foo": return software.amazon.jsii.tests.calculator.InterfaceInNamespaceIncludesClasses.Foo.class; case "jsii-calc.InterfaceInNamespaceIncludesClasses.Hello": return software.amazon.jsii.tests.calculator.InterfaceInNamespaceIncludesClasses.Hello.class; case "jsii-calc.InterfaceInNamespaceOnlyInterface.Hello": return software.amazon.jsii.tests.calculator.InterfaceInNamespaceOnlyInterface.Hello.class; - case "jsii-calc.InterfaceWithOptionalMethodArguments": return software.amazon.jsii.tests.calculator.InterfaceWithOptionalMethodArguments.class; + case "jsii-calc.InterfaceWithProperties": return software.amazon.jsii.tests.calculator.InterfaceWithProperties.class; + case "jsii-calc.InterfaceWithPropertiesExtension": return software.amazon.jsii.tests.calculator.InterfaceWithPropertiesExtension.class; case "jsii-calc.JSObjectLiteralForInterface": return software.amazon.jsii.tests.calculator.JSObjectLiteralForInterface.class; case "jsii-calc.JSObjectLiteralToNative": return software.amazon.jsii.tests.calculator.JSObjectLiteralToNative.class; case "jsii-calc.JSObjectLiteralToNativeClass": return software.amazon.jsii.tests.calculator.JSObjectLiteralToNativeClass.class; @@ -66,7 +67,6 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.Polymorphism": return software.amazon.jsii.tests.calculator.Polymorphism.class; case "jsii-calc.Power": return software.amazon.jsii.tests.calculator.Power.class; case "jsii-calc.ReferenceEnumFromScopedPackage": return software.amazon.jsii.tests.calculator.ReferenceEnumFromScopedPackage.class; - case "jsii-calc.ReturnsNumber": return software.amazon.jsii.tests.calculator.ReturnsNumber.class; case "jsii-calc.RuntimeTypeChecking": return software.amazon.jsii.tests.calculator.RuntimeTypeChecking.class; case "jsii-calc.Statics": return software.amazon.jsii.tests.calculator.Statics.class; case "jsii-calc.StringEnum": return software.amazon.jsii.tests.calculator.StringEnum.class; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithPrivateConstructorAndAutomaticProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithPrivateConstructorAndAutomaticProperties.java index 9ea826ef91..964c5e1f8d 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithPrivateConstructorAndAutomaticProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithPrivateConstructorAndAutomaticProperties.java @@ -5,7 +5,7 @@ */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties") -public class ClassWithPrivateConstructorAndAutomaticProperties extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithProperties { +public class ClassWithPrivateConstructorAndAutomaticProperties extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.InterfaceWithProperties { protected ClassWithPrivateConstructorAndAutomaticProperties(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithOptionalMethodArguments.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithOptionalMethodArguments.java similarity index 86% rename from packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithOptionalMethodArguments.java rename to packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithOptionalMethodArguments.java index d1956e58ec..dd3f72e294 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithOptionalMethodArguments.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithOptionalMethodArguments.java @@ -5,14 +5,14 @@ * Interface proxies (and builders) do not respect optional arguments in methods */ @javax.annotation.Generated(value = "jsii-pacmak") -public interface InterfaceWithOptionalMethodArguments extends software.amazon.jsii.JsiiSerializable { +public interface IInterfaceWithOptionalMethodArguments extends software.amazon.jsii.JsiiSerializable { void hello(final java.lang.String arg1, @javax.annotation.Nullable final java.lang.Number arg2); void hello(final java.lang.String arg1); /** * 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.InterfaceWithOptionalMethodArguments { + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IInterfaceWithOptionalMethodArguments { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IReturnsNumber.java similarity index 83% rename from packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java rename to packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IReturnsNumber.java index 9604e0b172..352f2ef930 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ReturnsNumber.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IReturnsNumber.java @@ -1,14 +1,14 @@ package software.amazon.jsii.tests.calculator; @javax.annotation.Generated(value = "jsii-pacmak") -public interface ReturnsNumber extends software.amazon.jsii.JsiiSerializable { +public interface IReturnsNumber extends software.amazon.jsii.JsiiSerializable { java.lang.Number getNumberProp(); java.lang.Number obtainNumber(); /** * 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.ReturnsNumber { + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.IReturnsNumber { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithProperties.java similarity index 86% rename from packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java rename to packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithProperties.java index 2d578cf668..f4f8aa2272 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithProperties.java @@ -1,20 +1,20 @@ package software.amazon.jsii.tests.calculator; @javax.annotation.Generated(value = "jsii-pacmak") -public interface IInterfaceWithProperties extends software.amazon.jsii.JsiiSerializable { +public interface InterfaceWithProperties extends software.amazon.jsii.JsiiSerializable { java.lang.String getReadOnlyString(); java.lang.String getReadWriteString(); void setReadWriteString(final java.lang.String value); /** - * @return a {@link Builder} of {@link IInterfaceWithProperties} + * @return a {@link Builder} of {@link InterfaceWithProperties} */ static Builder builder() { return new Builder(); } /** - * A builder for {@link IInterfaceWithProperties} + * A builder for {@link InterfaceWithProperties} */ final class Builder { private java.lang.String _readOnlyString; @@ -41,11 +41,11 @@ public Builder withReadWriteString(final java.lang.String value) { /** * Builds the configured instance. - * @return a new instance of {@link IInterfaceWithProperties} + * @return a new instance of {@link InterfaceWithProperties} * @throws NullPointerException if any required attribute was not provided */ - public IInterfaceWithProperties build() { - return new IInterfaceWithProperties() { + public InterfaceWithProperties build() { + return new InterfaceWithProperties() { private final java.lang.String $readOnlyString = java.util.Objects.requireNonNull(_readOnlyString, "readOnlyString is required"); private java.lang.String $readWriteString = java.util.Objects.requireNonNull(_readWriteString, "readWriteString is required"); @@ -71,7 +71,7 @@ public void setReadWriteString(final java.lang.String value) { /** * 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.IInterfaceWithProperties { + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.InterfaceWithProperties { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithPropertiesExtension.java similarity index 87% rename from packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java rename to packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithPropertiesExtension.java index d5509a49c4..ba6b8ae3a4 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/IInterfaceWithPropertiesExtension.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/InterfaceWithPropertiesExtension.java @@ -1,19 +1,19 @@ package software.amazon.jsii.tests.calculator; @javax.annotation.Generated(value = "jsii-pacmak") -public interface IInterfaceWithPropertiesExtension extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.IInterfaceWithProperties { +public interface InterfaceWithPropertiesExtension extends software.amazon.jsii.JsiiSerializable, software.amazon.jsii.tests.calculator.InterfaceWithProperties { java.lang.Number getFoo(); void setFoo(final java.lang.Number value); /** - * @return a {@link Builder} of {@link IInterfaceWithPropertiesExtension} + * @return a {@link Builder} of {@link InterfaceWithPropertiesExtension} */ static Builder builder() { return new Builder(); } /** - * A builder for {@link IInterfaceWithPropertiesExtension} + * A builder for {@link InterfaceWithPropertiesExtension} */ final class Builder { private java.lang.Number _foo; @@ -50,11 +50,11 @@ public Builder withReadWriteString(final java.lang.String value) { /** * Builds the configured instance. - * @return a new instance of {@link IInterfaceWithPropertiesExtension} + * @return a new instance of {@link InterfaceWithPropertiesExtension} * @throws NullPointerException if any required attribute was not provided */ - public IInterfaceWithPropertiesExtension build() { - return new IInterfaceWithPropertiesExtension() { + public InterfaceWithPropertiesExtension build() { + return new InterfaceWithPropertiesExtension() { private java.lang.Number $foo = java.util.Objects.requireNonNull(_foo, "foo is required"); private final java.lang.String $readOnlyString = java.util.Objects.requireNonNull(_readOnlyString, "readOnlyString is required"); private java.lang.String $readWriteString = java.util.Objects.requireNonNull(_readWriteString, "readWriteString is required"); @@ -91,7 +91,7 @@ public void setReadWriteString(final java.lang.String value) { /** * 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.IInterfaceWithPropertiesExtension { + final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.InterfaceWithPropertiesExtension { protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java index c02af4d61d..895e8ba105 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OverrideReturnsObject.java @@ -11,7 +11,7 @@ public OverrideReturnsObject() { software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } - public java.lang.Number test(final software.amazon.jsii.tests.calculator.ReturnsNumber obj) { + public java.lang.Number test(final software.amazon.jsii.tests.calculator.IReturnsNumber obj) { return this.jsiiCall("test", java.lang.Number.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(obj, "obj is required")).toArray()); } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java index f82f1f44ac..6daa859bd9 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/UsesInterfaceWithProperties.java @@ -6,7 +6,7 @@ public class UsesInterfaceWithProperties extends software.amazon.jsii.JsiiObject protected UsesInterfaceWithProperties(final software.amazon.jsii.JsiiObject.InitializationMode mode) { super(mode); } - public UsesInterfaceWithProperties(final software.amazon.jsii.tests.calculator.IInterfaceWithProperties obj) { + public UsesInterfaceWithProperties(final software.amazon.jsii.tests.calculator.InterfaceWithProperties obj) { super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.of(java.util.Objects.requireNonNull(obj, "obj is required")).toArray()); } @@ -15,7 +15,7 @@ public java.lang.String justRead() { return this.jsiiCall("justRead", java.lang.String.class); } - public java.lang.String readStringAndNumber(final software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension ext) { + public java.lang.String readStringAndNumber(final software.amazon.jsii.tests.calculator.InterfaceWithPropertiesExtension ext) { return this.jsiiCall("readStringAndNumber", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(ext, "ext is required")).toArray()); } @@ -23,7 +23,7 @@ public java.lang.String writeAndRead(final java.lang.String value) { return this.jsiiCall("writeAndRead", java.lang.String.class, java.util.stream.Stream.of(java.util.Objects.requireNonNull(value, "value is required")).toArray()); } - public software.amazon.jsii.tests.calculator.IInterfaceWithProperties getObj() { - return this.jsiiGet("obj", software.amazon.jsii.tests.calculator.IInterfaceWithProperties.class); + public software.amazon.jsii.tests.calculator.InterfaceWithProperties getObj() { + return this.jsiiGet("obj", software.amazon.jsii.tests.calculator.InterfaceWithProperties.class); } } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst index df7f522b5f..b133d19151 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/jsii-calc.rst @@ -1036,7 +1036,7 @@ ClassWithPrivateConstructorAndAutomaticProperties Class that implements interface properties automatically, but using a private constructor - :implements: :py:class:`~jsii-calc.IInterfaceWithProperties`\ + :implements: :py:class:`~jsii-calc.InterfaceWithProperties`\ .. py:staticmethod:: create(readOnlyString, readWriteString) -> jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties @@ -1049,14 +1049,14 @@ ClassWithPrivateConstructorAndAutomaticProperties .. py:attribute:: readOnlyString - *Implements* :py:meth:`jsii-calc.IInterfaceWithProperties.readOnlyString` + *Implements* :py:meth:`jsii-calc.InterfaceWithProperties.readOnlyString` :type: string *(readonly)* .. py:attribute:: readWriteString - *Implements* :py:meth:`jsii-calc.IInterfaceWithProperties.readWriteString` + *Implements* :py:meth:`jsii-calc.InterfaceWithProperties.readWriteString` :type: string @@ -1647,10 +1647,10 @@ IInterfaceWithMethods (interface) :abstract: Yes -IInterfaceWithProperties (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +IInterfaceWithOptionalMethodArguments (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:class:: IInterfaceWithProperties +.. py:class:: IInterfaceWithOptionalMethodArguments **Language-specific names:** @@ -1662,34 +1662,36 @@ IInterfaceWithProperties (interface) .. code-tab:: java - import software.amazon.jsii.tests.calculator.IInterfaceWithProperties; + import software.amazon.jsii.tests.calculator.IInterfaceWithOptionalMethodArguments; .. code-tab:: javascript - // IInterfaceWithProperties is an interface + // IInterfaceWithOptionalMethodArguments is an interface .. code-tab:: typescript - import { IInterfaceWithProperties } from 'jsii-calc'; + import { IInterfaceWithOptionalMethodArguments } from 'jsii-calc'; + awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods - .. py:attribute:: readOnlyString - :type: string *(readonly)* *(abstract)* + .. py:method:: hello(arg1, [arg2]) - .. py:attribute:: readWriteString - - :type: string *(abstract)* + :param arg1: + :type arg1: string + :param arg2: + :type arg2: number or ``undefined`` + :abstract: Yes -IInterfaceWithPropertiesExtension (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +IRandomNumberGenerator (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:class:: IInterfaceWithPropertiesExtension +.. py:class:: IRandomNumberGenerator **Language-specific names:** @@ -1701,44 +1703,37 @@ IInterfaceWithPropertiesExtension (interface) .. code-tab:: java - import software.amazon.jsii.tests.calculator.IInterfaceWithPropertiesExtension; + import software.amazon.jsii.tests.calculator.IRandomNumberGenerator; .. code-tab:: javascript - // IInterfaceWithPropertiesExtension is an interface + // IRandomNumberGenerator is an interface .. code-tab:: typescript - import { IInterfaceWithPropertiesExtension } from 'jsii-calc'; - - + import { IRandomNumberGenerator } from 'jsii-calc'; - :extends: :py:class:`~jsii-calc.IInterfaceWithProperties`\ - .. py:attribute:: foo - - :type: number *(abstract)* + Generates random numbers. - .. py:attribute:: readOnlyString - *Inherited from* :py:attr:`jsii-calc.IInterfaceWithProperties ` - - :type: string *(readonly)* *(abstract)* + .. py:method:: next() -> number - .. py:attribute:: readWriteString + Returns another random number. - *Inherited from* :py:attr:`jsii-calc.IInterfaceWithProperties ` - :type: string *(abstract)* + :return: A random number. + :rtype: number + :abstract: Yes -IRandomNumberGenerator (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +IReturnsNumber (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:class:: IRandomNumberGenerator +.. py:class:: IReturnsNumber **Language-specific names:** @@ -1750,29 +1745,27 @@ IRandomNumberGenerator (interface) .. code-tab:: java - import software.amazon.jsii.tests.calculator.IRandomNumberGenerator; + import software.amazon.jsii.tests.calculator.IReturnsNumber; .. code-tab:: javascript - // IRandomNumberGenerator is an interface + // IReturnsNumber is an interface .. code-tab:: typescript - import { IRandomNumberGenerator } from 'jsii-calc'; - + import { IReturnsNumber } from 'jsii-calc'; - Generates random numbers. + .. py:attribute:: numberProp - .. py:method:: next() -> number + :type: number *(readonly)* *(abstract)* - Returns another random number. + .. py:method:: obtainNumber() -> number - :return: A random number. :rtype: number :abstract: Yes @@ -1980,10 +1973,10 @@ Hello (interface) .. py:currentmodule:: jsii-calc -InterfaceWithOptionalMethodArguments (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +InterfaceWithProperties (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. py:class:: InterfaceWithOptionalMethodArguments +.. py:class:: InterfaceWithProperties **Language-specific names:** @@ -1995,30 +1988,77 @@ InterfaceWithOptionalMethodArguments (interface) .. code-tab:: java - import software.amazon.jsii.tests.calculator.InterfaceWithOptionalMethodArguments; + import software.amazon.jsii.tests.calculator.InterfaceWithProperties; .. code-tab:: javascript - // InterfaceWithOptionalMethodArguments is an interface + // InterfaceWithProperties is an interface .. code-tab:: typescript - import { InterfaceWithOptionalMethodArguments } from 'jsii-calc'; + import { InterfaceWithProperties } from 'jsii-calc'; - awslabs/jsii#175 Interface proxies (and builders) do not respect optional arguments in methods + .. py:attribute:: readOnlyString + :type: string *(readonly)* *(abstract)* - .. py:method:: hello(arg1, [arg2]) - :param arg1: - :type arg1: string - :param arg2: - :type arg2: number or ``undefined`` - :abstract: Yes + .. py:attribute:: readWriteString + + :type: string *(abstract)* + + +InterfaceWithPropertiesExtension (interface) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. py:class:: InterfaceWithPropertiesExtension + + **Language-specific names:** + + .. tabs:: + + .. code-tab:: c# + + using Amazon.JSII.Tests.CalculatorNamespace; + + .. code-tab:: java + + import software.amazon.jsii.tests.calculator.InterfaceWithPropertiesExtension; + + .. code-tab:: javascript + + // InterfaceWithPropertiesExtension is an interface + + .. code-tab:: typescript + + import { InterfaceWithPropertiesExtension } from 'jsii-calc'; + + + + :extends: :py:class:`~jsii-calc.InterfaceWithProperties`\ + + + .. py:attribute:: foo + + :type: number *(abstract)* + + + .. py:attribute:: readOnlyString + + *Inherited from* :py:attr:`jsii-calc.InterfaceWithProperties ` + + :type: string *(readonly)* *(abstract)* + + + .. py:attribute:: readWriteString + + *Inherited from* :py:attr:`jsii-calc.InterfaceWithProperties ` + + :type: string *(abstract)* JSObjectLiteralForInterface @@ -2878,7 +2918,7 @@ OverrideReturnsObject .. py:method:: test(obj) -> number :param obj: - :type obj: :py:class:`~jsii-calc.ReturnsNumber`\ + :type obj: :py:class:`~jsii-calc.IReturnsNumber`\ :rtype: number @@ -3084,46 +3124,6 @@ ReferenceEnumFromScopedPackage :type: :py:class:`@scope/jsii-calc-lib.EnumFromScopedModule`\ or ``undefined`` -ReturnsNumber (interface) -^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. py:class:: ReturnsNumber - - **Language-specific names:** - - .. tabs:: - - .. code-tab:: c# - - using Amazon.JSII.Tests.CalculatorNamespace; - - .. code-tab:: java - - import software.amazon.jsii.tests.calculator.ReturnsNumber; - - .. code-tab:: javascript - - // ReturnsNumber is an interface - - .. code-tab:: typescript - - import { ReturnsNumber } from 'jsii-calc'; - - - - - - .. py:attribute:: numberProp - - :type: number *(readonly)* *(abstract)* - - - .. py:method:: obtainNumber() -> number - - :rtype: number - :abstract: Yes - - RuntimeTypeChecking ^^^^^^^^^^^^^^^^^^^ @@ -3765,7 +3765,7 @@ UsesInterfaceWithProperties :param obj: - :type obj: :py:class:`~jsii-calc.IInterfaceWithProperties`\ + :type obj: :py:class:`~jsii-calc.InterfaceWithProperties`\ .. py:method:: justRead() -> string @@ -3775,7 +3775,7 @@ UsesInterfaceWithProperties .. py:method:: readStringAndNumber(ext) -> string :param ext: - :type ext: :py:class:`~jsii-calc.IInterfaceWithPropertiesExtension`\ + :type ext: :py:class:`~jsii-calc.InterfaceWithPropertiesExtension`\ :rtype: string @@ -3788,7 +3788,7 @@ UsesInterfaceWithProperties .. py:attribute:: obj - :type: :py:class:`~jsii-calc.IInterfaceWithProperties`\ *(readonly)* + :type: :py:class:`~jsii-calc.InterfaceWithProperties`\ *(readonly)* VariadicMethod diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index c289900ca9..4a88094027 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -577,7 +577,7 @@ export class Assembler implements Emitter { // To keep the spec minimal the actual values of the attribute are "true" or "undefined" (to represent "false"). // tslint:disable-next-line:no-console this._deferUntilTypesAvailable(fqn, jsiiType.interfaces || [], type.symbol.valueDeclaration, (...bases: spec.Type[]) => { - if ((jsiiType.methods || []).length === 0 && (jsiiType.properties || []).length > 0) { + if ((jsiiType.methods || []).length === 0) { jsiiType.datatype = true; } for (const base of bases) { @@ -585,6 +585,20 @@ export class Assembler implements Emitter { jsiiType.datatype = undefined; } } + + const interfaceName = isInterfaceName(jsiiType.name); + + // If it's not a datatype the name must start with an "I". + if (!jsiiType.datatype && !interfaceName) { + this._diagnostic(type.symbol.declarations[0], + ts.DiagnosticCategory.Error, + `Interface contains behavior: name should be "I${jsiiType.name}"`); + } + + // If the name starts with an "I" it is not intended as a datatype, so switch that off. + if (jsiiType.datatype && interfaceName) { + jsiiType.datatype = undefined; + } }); return _sortMembers(this._visitDocumentation(type.symbol, jsiiType)); @@ -1008,4 +1022,14 @@ interface DeferredRecord { * Callback representing the action to run. */ cb: () => void; +} + +/** + * Whether or not the given name is conventionally an interface name + * + * It's an interface name if it starts with I and has another capital + * (so we don't mark IonicColumnProps as an interface). + */ +function isInterfaceName(name: string) { + return name.length >= 2 && name.charAt(0) === 'I' && name.charAt(1).toUpperCase() === name.charAt(1); } \ No newline at end of file diff --git a/packages/jsii/test/negatives/neg.behavior-requires-iprefix.ts b/packages/jsii/test/negatives/neg.behavior-requires-iprefix.ts new file mode 100644 index 0000000000..b9ad826f8d --- /dev/null +++ b/packages/jsii/test/negatives/neg.behavior-requires-iprefix.ts @@ -0,0 +1,8 @@ +// tslint:disable:comment-format +// tslint:disable-next-line:max-line-length +///!MATCH_ERROR: Interface contains behavior: name should be "ISomething" + +export interface Something { + // The presence of this method requires an I prefix on the interface + doSomething(): void; +} \ No newline at end of file