diff --git a/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests.sln.DotSettings.user b/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests.sln.DotSettings.user index e5df662974..d518dc764e 100644 --- a/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests.sln.DotSettings.user +++ b/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests.sln.DotSettings.user @@ -1,4 +1,4 @@  <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;Amazon.JSII.Runtime.IntegrationTests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <Project Location="/Users/rmuller/Development/aws/jsii/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests" Presentation="&lt;Amazon.JSII.Runtime.IntegrationTests&gt;" /> + <Solution /> </SessionState> \ No newline at end of file diff --git a/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/TypeCheckingTests.cs b/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/TypeCheckingTests.cs new file mode 100644 index 0000000000..0c8b727f13 --- /dev/null +++ b/packages/@jsii/dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/TypeCheckingTests.cs @@ -0,0 +1,67 @@ + +using System; +using System.Collections.Generic; +using Amazon.JSII.Tests.CalculatorNamespace; +using Xunit; + +#pragma warning disable CS0612 + +namespace Amazon.JSII.Runtime.IntegrationTests +{ + public sealed class TypeCheckingTests : IClassFixture, IDisposable + { + const string Prefix = nameof(TypeCheckingTests) + "."; + + private readonly IDisposable _serviceContainerFixture; + + public TypeCheckingTests(ServiceContainerFixture serviceContainerFixture) + { + _serviceContainerFixture = serviceContainerFixture; + } + + void IDisposable.Dispose() + { + _serviceContainerFixture.Dispose(); + } + + [Fact(DisplayName = Prefix + nameof(Constructor))] + public void Constructor() + { + var exception = Assert.Throws(() => + new ClassWithCollectionOfUnions(new IDictionary[] + { + new Dictionary + { + { "good", new StructA { RequiredString = "present"} }, + { "bad", $"Not a {nameof(StructA)} or {nameof(StructB)}" }, + } + }) + ); + Assert.Equal("Expected argument unionProperty[0][\"bad\"] to be one of: Amazon.JSII.Tests.CalculatorNamespace.IStructA, Amazon.JSII.Tests.CalculatorNamespace.IStructB; received System.String (Parameter 'unionProperty')", exception.Message); + } + + [Fact(DisplayName = Prefix + nameof(Setter))] + public void Setter() + { + var subject = new ClassWithCollectionOfUnions(Array.Empty>()); + var exception = Assert.Throws(() => + subject.UnionProperty = new IDictionary[] + { + new Dictionary + { + { "good", new StructA { RequiredString = "present" } }, + { "bad", $"Not a {nameof(StructA)} or {nameof(StructB)}" }, + } + }); + Assert.Equal("Expected value[0][\"bad\"] to be one of: Amazon.JSII.Tests.CalculatorNamespace.IStructA, Amazon.JSII.Tests.CalculatorNamespace.IStructB; received System.String (Parameter 'value')", exception.Message); + } + + [Fact(DisplayName = Prefix + nameof(StaticMethod))] + public void StaticMethod() + { + var exception = Assert.Throws(() => + StructUnionConsumer.IsStructA("Not a StructA")); + Assert.Equal("Expected argument struct to be one of: Amazon.JSII.Tests.CalculatorNamespace.IStructA, Amazon.JSII.Tests.CalculatorNamespace.IStructB; received System.String (Parameter 'struct')", exception.Message); + } + } +} \ No newline at end of file diff --git a/packages/@jsii/dotnet-runtime/src/Amazon.JSII.Runtime/Configuration.cs b/packages/@jsii/dotnet-runtime/src/Amazon.JSII.Runtime/Configuration.cs new file mode 100644 index 0000000000..817697a017 --- /dev/null +++ b/packages/@jsii/dotnet-runtime/src/Amazon.JSII.Runtime/Configuration.cs @@ -0,0 +1,20 @@ +using System; + +namespace Amazon.JSII.Runtime +{ + public static class Configuration + { + /// + /// Enables or disables runtime type checking of parameters when the original model expects a type union, which + /// is represented as object in .NET code. + /// + /// + /// This feature is enabled by default. + /// + /// This feature may be disabled as a work-around if a bug prevents your application from working correctly, or + /// in order to stop paying the performance cost of the runtime type checking. + /// + /// + public static bool RuntimeTypeChecking { get; set; } = true; + } +} \ No newline at end of file diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index 69ac7daa09..30cc75e079 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -3050,3 +3050,13 @@ export class TwoMethodsWithSimilarCapitalization { */ public readonly fooBAR = 111; } + +export class ClassWithCollectionOfUnions { + public constructor( + public unionProperty: Array>, + ) {} +} + +export interface StructWithCollectionOfUnionts { + readonly unionProperty: Array>; +} diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index c8af814015..040053d0dc 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -2447,6 +2447,90 @@ ], "symbolId": "lib/compliance:ClassThatImplementsThePrivateInterface" }, + "jsii-calc.ClassWithCollectionOfUnions": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.ClassWithCollectionOfUnions", + "initializer": { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3055 + }, + "parameters": [ + { + "name": "unionProperty", + "type": { + "collection": { + "elementtype": { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "jsii-calc.StructA" + }, + { + "fqn": "jsii-calc.StructB" + } + ] + } + }, + "kind": "map" + } + }, + "kind": "array" + } + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3054 + }, + "name": "ClassWithCollectionOfUnions", + "properties": [ + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3056 + }, + "name": "unionProperty", + "type": { + "collection": { + "elementtype": { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "jsii-calc.StructA" + }, + { + "fqn": "jsii-calc.StructB" + } + ] + } + }, + "kind": "map" + } + }, + "kind": "array" + } + } + } + ], + "symbolId": "lib/compliance:ClassWithCollectionOfUnions" + }, "jsii-calc.ClassWithCollections": { "assembly": "jsii-calc", "docs": { @@ -13549,6 +13633,57 @@ "name": "StructUnionConsumer", "symbolId": "lib/compliance:StructUnionConsumer" }, + "jsii-calc.StructWithCollectionOfUnionts": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.StructWithCollectionOfUnionts", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3060 + }, + "name": "StructWithCollectionOfUnionts", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 3061 + }, + "name": "unionProperty", + "type": { + "collection": { + "elementtype": { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "jsii-calc.StructA" + }, + { + "fqn": "jsii-calc.StructB" + } + ] + } + }, + "kind": "map" + } + }, + "kind": "array" + } + } + } + ], + "symbolId": "lib/compliance:StructWithCollectionOfUnionts" + }, "jsii-calc.StructWithEnum": { "assembly": "jsii-calc", "datatype": true, @@ -17653,5 +17788,5 @@ } }, "version": "3.20.120", - "fingerprint": "P+E1ta4n5zaxREzT7CqW574NyC10CNmKv5NAwZ5pRt8=" + "fingerprint": "4J4zpGOrJJsMNdeBDVxr5OLa4LaClMA61HDRI4Wnajg=" } \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts index 47a35d6507..ceaec72961 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnetgenerator.ts @@ -386,13 +386,26 @@ export class DotNetGenerator extends Generator { // Abstract classes have protected constructors. const visibility = cls.abstract ? 'protected' : 'public'; + this.code.openBlock( + `${visibility} ${className}(${parametersDefinition}): base(_MakeDeputyProps(${parametersBase}))`, + ); + this.code.closeBlock(); + this.code.line(); + + // This private method is injected so we can validate arguments before deferring to the base constructor, where + // the instance will be created in the kernel (where it'd fail on a sub-optimal error instead)... + this.code.line( + '[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]', + ); + this.code.openBlock( + `private static DeputyProps _MakeDeputyProps(${parametersDefinition})`, + ); + this.emitUnionParameterValdation(initializer.parameters); const args = parametersBase.length > 0 ? `new object?[]{${parametersBase}}` : `System.Array.Empty()`; - this.code.openBlock( - `${visibility} ${className}(${parametersDefinition}): base(new DeputyProps(${args}))`, - ); + this.code.line(`return new DeputyProps(${args});`); this.code.closeBlock(); this.code.line(); } @@ -611,6 +624,7 @@ export class DotNetGenerator extends Generator { this.code.openBlock( `${access} ${staticKeyWord}${overrideKeyWord}${virtualKeyWord}${signature}`, ); + this.emitUnionParameterValdation(method.parameters); this.code.line( this.dotnetRuntimeGenerator.createInvokeMethodIdentifier( method, @@ -621,6 +635,176 @@ export class DotNetGenerator extends Generator { } } + /** + * Emits type checks for values passed for type union parameters. + * + * @param parameters the list of parameters received by the function. + * @param noMangle use parameter names as-is (useful for setters, for example) instead of mangling them. + */ + private emitUnionParameterValdation( + parameters?: readonly spec.Parameter[], + { noMangle = false }: { noMangle?: boolean } = {}, + ): void { + const unionParameters = parameters?.filter(({ type }) => + containsUnionType(type), + ); + if (unionParameters == null || unionParameters.length === 0) { + return; + } + this.code.openBlock( + 'if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking)', + ); + for (const param of unionParameters) { + const name = noMangle + ? param.name + : this.nameutils.convertParameterName(param.name); + + if (param.optional) { + this.code.openBlock(`if (${name} != null)`); + } + + validate.call( + this, + name, + noMangle ? name : `argument {nameof(${name})}`, + param.type, + noMangle ? name : `{nameof(${name})}`, + ); + + if (param.optional) { + this.code.closeBlock(); + } + } + this.code.closeBlock(); + + function validate( + this: DotNetGenerator, + value: string, + descr: string, + type: spec.TypeReference, + parameterName: string, + ) { + if (spec.isUnionTypeReference(type)) { + validateTypeUnion.call(this, value, descr, type, parameterName); + } else { + const collectionType = type as spec.CollectionTypeReference; + if (collectionType.collection.kind === spec.CollectionKind.Array) { + validateArray.call( + this, + value, + descr, + collectionType.collection.elementtype, + parameterName, + ); + } else if (collectionType.collection.kind === spec.CollectionKind.Map) { + validateMap.call( + this, + value, + descr, + collectionType.collection.elementtype, + parameterName, + ); + } else { + throw new Error( + `Unhandled collection kind: ${spec.describeTypeReference(type)}`, + ); + } + } + } + + function validateArray( + this: DotNetGenerator, + value: string, + descr: string, + elementType: spec.TypeReference, + parameterName: string, + ) { + const varName = `__idx_${descr.replace(/[^a-z0-9_]/gi, '_')}`; + this.code.openBlock( + `for (int ${varName} = 0 ; ${varName} < ${value}.Length ; ${varName}++)`, + ); + validate.call( + this, + `${value}[${varName}]`, + `${descr}[{${varName}}]`, + elementType, + parameterName, + ); + this.code.closeBlock(); + } + + function validateMap( + this: DotNetGenerator, + value: string, + descr: string, + elementType: spec.TypeReference, + parameterName: string, + ) { + const varName = `__item_${descr.replace(/[^a-z0-9_]/gi, '_')}`; + this.code.openBlock(`foreach (var ${varName} in ${value})`); + validate.call( + this, + `${varName}.Value`, + `${descr}[\\"{${varName}.Key}\\"]`, + elementType, + parameterName, + ); + this.code.closeBlock(); + } + + function validateTypeUnion( + this: DotNetGenerator, + value: string, + descr: string, + type: spec.UnionTypeReference, + parameterName: string, + ) { + this.code.indent('if ('); + let emitAnd = false; + const typeRefs = type.union.types; + for (const typeRef of typeRefs) { + const prefix = emitAnd ? '&& ' : ''; + const dotNetType = this.typeresolver.toDotNetType(typeRef); + // In the case of double, we test for all standard numeric types of .NET (these implicitly convert). + const test = + dotNetType === 'double' + ? [ + 'byte', + 'decimal', + 'double', + 'float', + 'int', + 'long', + 'sbyte', + 'short', + 'uint', + 'ulong', + 'ushort', + ] + .map((numeric) => `${value} is ${numeric}`) + .join(' || ') + : `${value} is ${dotNetType}`; + this.code.line(`${prefix}!(${test})`); + emitAnd = true; + } + this.code.unindent(')'); + this.code.openBlock(''); + const placeholders = typeRefs + .map((typeRef) => { + const typeName = this.typeresolver.toDotNetTypeName(typeRef); + if (typeName.startsWith('"') && typeName.endsWith('"')) { + return typeName.slice(1, -1); + } + return `{${typeName}}`; + }) + .join(', '); + this.code.line( + `throw new System.ArgumentException($"Expected ${descr} to be one of: ${placeholders}; received {${value}.GetType().FullName}", $"${parameterName}");`, + ); + this.code.closeBlock(); + } + } + /** * Founds out if a member (property or method) is already defined in one of the base classes * @@ -958,6 +1142,21 @@ export class DotNetGenerator extends Generator { const access = this.renderAccessLevel(prop); const staticKeyWord = prop.static ? 'static ' : ''; const propName = this.nameutils.convertPropertyName(prop.name); + const propTypeFQN = this.typeresolver.toDotNetType(prop.type); + const isOptional = prop.optional ? '?' : ''; + + // We need to use a backing field so we can perform type checking if the property type is a union, and this is a struct. + const backingFieldName = + spec.isInterfaceType(cls) && datatype && containsUnionType(prop.type) + ? // We down-case the first letter, private fields are conventionally named with a _ prefix, and a camelCase name. + `_${propName.replace(/[A-Z]/, (c) => c.toLowerCase())}` + : undefined; + if (backingFieldName != null) { + this.code.line( + `private ${propTypeFQN}${isOptional} ${backingFieldName};`, + ); + this.code.line(); + } this.dotnetDocGenerator.emitDocs(prop, { api: 'member', @@ -994,13 +1193,13 @@ export class DotNetGenerator extends Generator { } } - const propTypeFQN = this.typeresolver.toDotNetType(prop.type); - const isOptional = prop.optional ? '?' : ''; const statement = `${access} ${isAbstractKeyword}${isVirtualKeyWord}${staticKeyWord}${isOverrideKeyWord}${propTypeFQN}${isOptional} ${propName}`; this.code.openBlock(statement); // Emit getters - if (datatype || prop.const || prop.abstract) { + if (backingFieldName != null) { + this.code.line(`get => ${backingFieldName};`); + } else if (datatype || prop.const || prop.abstract) { this.code.line('get;'); } else { // If the property is non-optional, add a bang to silence compiler warning @@ -1017,16 +1216,37 @@ export class DotNetGenerator extends Generator { } // Emit setters - if (datatype || (!prop.immutable && prop.abstract)) { + if (backingFieldName) { + this.code.openBlock('set'); + this.emitUnionParameterValdation( + [ + { + name: 'value', + type: prop.type, + optional: prop.optional, + }, + ], + { noMangle: true }, + ); + this.code.line(`${backingFieldName} = value;`); + this.code.closeBlock(); + } else if (datatype || (!prop.immutable && prop.abstract)) { this.code.line('set;'); } else { if (!prop.immutable) { - if (prop.static) { - this.code.line( - `set => SetStaticProperty(typeof(${className}), value);`, + const setCode = prop.static + ? `SetStaticProperty(typeof(${className}), value);` + : 'SetInstanceProperty(value);'; + if (containsUnionType(prop.type)) { + this.code.openBlock('set'); + this.emitUnionParameterValdation( + [{ name: 'value', optional: prop.optional, type: prop.type }], + { noMangle: true }, ); + this.code.line(setCode); + this.code.closeBlock(); } else { - this.code.line('set => SetInstanceProperty(value);'); + this.code.line(`set => ${setCode}`); } } } @@ -1321,3 +1541,13 @@ async function tryDownloadResource( }).once('error', ko), ); } + +function containsUnionType( + typeRef: spec.TypeReference, +): typeRef is spec.UnionTypeReference | spec.CollectionTypeReference { + return ( + spec.isUnionTypeReference(typeRef) || + (spec.isCollectionTypeReference(typeRef) && + containsUnionType(typeRef.collection.elementtype)) + ); +} diff --git a/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts index 5972fd5414..6278055f58 100644 --- a/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts +++ b/packages/jsii-pacmak/lib/targets/dotnet/dotnettyperesolver.ts @@ -138,6 +138,22 @@ export class DotNetTypeResolver { throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`); } + /** + * Translates any jsii type to the name of its corresponding .NET type (as a .NET string). + */ + public toDotNetTypeName(typeref: spec.TypeReference): string { + if (spec.isPrimitiveTypeReference(typeref)) { + return this.toDotNetPrimitiveName(typeref.primitive); + } else if (spec.isCollectionTypeReference(typeref)) { + return this.toDotNetCollectionName(typeref); + } else if (spec.isNamedTypeReference(typeref)) { + return `typeof(${this.toNativeFqn(typeref.fqn)}).FullName`; + } else if (typeref.union) { + return '"object"'; + } + throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`); + } + public resolveNamespace( assm: spec.AssemblyConfiguration, assmName: string, @@ -184,6 +200,28 @@ export class DotNetTypeResolver { } } + /** + * Translates a primitive in jsii to the name of a native .NET primitive + */ + private toDotNetPrimitiveName(primitive: spec.PrimitiveType): string { + switch (primitive) { + case spec.PrimitiveType.Boolean: + return '"bool"'; + case spec.PrimitiveType.Date: + return 'typeof(System.DateTime).FullName'; + case spec.PrimitiveType.Json: + return 'typeof(Newtonsoft.Json.Linq.JObject).FullName'; + case spec.PrimitiveType.Number: + return '"double"'; + case spec.PrimitiveType.String: + return '"string"'; + case spec.PrimitiveType.Any: + return '"object"'; + default: + throw new Error(`Unknown primitive type: ${primitive as any}`); + } + } + /** * Translates a collection in jsii to a native .NET collection */ @@ -200,4 +238,24 @@ export class DotNetTypeResolver { ); } } + + /** + * Translates a collection in jsii to the name of a native .NET collection + */ + private toDotNetCollectionName(ref: spec.CollectionTypeReference): string { + switch (ref.collection.kind) { + case spec.CollectionKind.Array: + const elementDotNetTypeName = this.toDotNetTypeName( + ref.collection.elementtype, + ); + return `$"{${elementDotNetTypeName}}[]"`; + case spec.CollectionKind.Map: + const elementDotNetType = this.toDotNetType(ref.collection.elementtype); + return `typeof(System.Collections.Generic.IDictionary).FullName`; + default: + throw new Error( + `Unsupported collection kind: ${ref.collection.kind as any}`, + ); + } + } } diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.js.snap index d4a153b75e..9e1e1702d7 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.js.snap @@ -1558,10 +1558,16 @@ namespace Example.Test.Demo [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace1), fullyQualifiedName: "testpkg.Namespace1")] public class Namespace1 : DeputyBase { - public Namespace1(): base(new DeputyProps(System.Array.Empty())) + public Namespace1(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -1662,10 +1668,16 @@ namespace Example.Test.Demo [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace2), fullyQualifiedName: "testpkg.Namespace2")] public class Namespace2 : DeputyBase { - public Namespace2(): base(new DeputyProps(System.Array.Empty())) + public Namespace2(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -1696,8 +1708,14 @@ namespace Example.Test.Demo [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace2.Foo.Final), fullyQualifiedName: "testpkg.Namespace2.Foo.Final")] public class Final : DeputyBase { - public Final(): base(new DeputyProps(System.Array.Empty())) + public Final(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap index 46a5f99b31..e6fcb0cb4c 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap @@ -84,10 +84,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base), fullyQualifiedName: "@scope/jsii-calc-base.Base")] public abstract class Base : DeputyBase { - protected Base(): base(new DeputyProps(System.Array.Empty())) + protected Base(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -256,8 +262,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.StaticConsumer), fullyQualifiedName: "@scope/jsii-calc-base.StaticConsumer")] public class StaticConsumer : DeputyBase { - public StaticConsumer(): base(new DeputyProps(System.Array.Empty())) + public StaticConsumer(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -699,8 +711,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very), fullyQualifiedName: "@scope/jsii-calc-base-of-base.Very")] public class Very : DeputyBase { - public Very(): base(new DeputyProps(System.Array.Empty())) + public Very(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -1083,8 +1101,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace /// Stability: Deprecated /// [System.Obsolete()] - public BaseFor2647(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(new DeputyProps(new object?[]{very})) + public BaseFor2647(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(_MakeDeputyProps(very)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very) { + return new DeputyProps(new object?[]{very}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -1874,10 +1898,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace /// Stability: Deprecated /// [System.Obsolete()] - public Number(double @value): base(new DeputyProps(new object?[]{@value})) + public Number(double @value): base(_MakeDeputyProps(@value)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double @value) + { + return new DeputyProps(new object?[]{@value}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.Obsolete()] @@ -1935,8 +1965,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace [System.Obsolete()] public abstract class NumericValue : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base { - protected NumericValue(): base(new DeputyProps(System.Array.Empty())) + protected NumericValue(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -2018,8 +2054,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace [System.Obsolete()] public abstract class Operation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue { - protected Operation(): base(new DeputyProps(System.Array.Empty())) + protected Operation(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -2317,8 +2359,14 @@ namespace Amazon.JSII.Tests.CustomSubmoduleName /// Stability: Deprecated /// [System.Obsolete()] - public NestedClass(): base(new DeputyProps(System.Array.Empty())) + public NestedClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -2478,10 +2526,16 @@ namespace Amazon.JSII.Tests.CustomSubmoduleName /// Stability: Deprecated /// [System.Obsolete()] - public Reflector(): base(new DeputyProps(System.Array.Empty())) + public Reflector(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.Obsolete()] @@ -2766,6 +2820,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 ChildStruct982.cs ┃ ┣━ 📄 ClassThatImplementsTheInternalInterface.cs ┃ ┣━ 📄 ClassThatImplementsThePrivateInterface.cs + ┃ ┣━ 📄 ClassWithCollectionOfUnions.cs ┃ ┣━ 📄 ClassWithCollections.cs ┃ ┣━ 📄 ClassWithContainerTypes.cs ┃ ┣━ 📄 ClassWithDocs.cs @@ -2914,6 +2969,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 IStructB.cs ┃ ┣━ 📄 IStructParameterType.cs ┃ ┣━ 📄 IStructReturningDelegate.cs + ┃ ┣━ 📄 IStructWithCollectionOfUnionts.cs ┃ ┣━ 📄 IStructWithEnum.cs ┃ ┣━ 📄 IStructWithJavaReservedWords.cs ┃ ┣━ 📄 ISupportsNiceJavaBuilderProps.cs @@ -3045,6 +3101,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 StructParameterType.cs ┃ ┣━ 📄 StructPassing.cs ┃ ┣━ 📄 StructUnionConsumer.cs + ┃ ┣━ 📄 StructWithCollectionOfUnionts.cs ┃ ┣━ 📄 StructWithEnum.cs ┃ ┣━ 📄 StructWithJavaReservedWords.cs ┃ ┣━ 📁 Submodule @@ -3168,8 +3225,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClass), fullyQualifiedName: "jsii-calc.AbstractClass")] public abstract class AbstractClass : Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase, Amazon.JSII.Tests.CalculatorNamespace.IInterfaceImplementedByAbstractClass { - protected AbstractClass(): base(new DeputyProps(System.Array.Empty())) + protected AbstractClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3236,8 +3299,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClassBase), fullyQualifiedName: "jsii-calc.AbstractClassBase")] public abstract class AbstractClassBase : DeputyBase { - protected AbstractClassBase(): base(new DeputyProps(System.Array.Empty())) + protected AbstractClassBase(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3288,8 +3357,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractClassReturner), fullyQualifiedName: "jsii-calc.AbstractClassReturner")] public class AbstractClassReturner : DeputyBase { - public AbstractClassReturner(): base(new DeputyProps(System.Array.Empty())) + public AbstractClassReturner(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3339,10 +3414,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AbstractSuite), fullyQualifiedName: "jsii-calc.AbstractSuite")] public abstract class AbstractSuite : DeputyBase { - protected AbstractSuite(): base(new DeputyProps(System.Array.Empty())) + protected AbstractSuite(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -3416,8 +3497,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - public Add(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(new DeputyProps(new object?[]{lhs, rhs})) + public Add(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(_MakeDeputyProps(lhs, rhs)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs) { + return new DeputyProps(new object?[]{lhs, rhs}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3467,8 +3554,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AllTypes), fullyQualifiedName: "jsii-calc.AllTypes")] public class AllTypes : DeputyBase { - public AllTypes(): base(new DeputyProps(System.Array.Empty())) + public AllTypes(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3590,21 +3683,72 @@ namespace Amazon.JSII.Tests.CalculatorNamespace public virtual object[] UnionArrayProperty { get => GetInstanceProperty()!; - set => SetInstanceProperty(value); + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + for (int __idx_value = 0 ; __idx_value < value.Length ; __idx_value++) + { + if ( + !(value[__idx_value] is byte || value[__idx_value] is decimal || value[__idx_value] is double || value[__idx_value] is float || value[__idx_value] is int || value[__idx_value] is long || value[__idx_value] is sbyte || value[__idx_value] is short || value[__idx_value] is uint || value[__idx_value] is ulong || value[__idx_value] is ushort) + && !(value[__idx_value] is Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue) + ) + + { + throw new System.ArgumentException($"Expected value[{__idx_value}] to be one of: double, {typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue).FullName}; received {value[__idx_value].GetType().FullName}", $"value"); + } + } + } + SetInstanceProperty(value); + } } [JsiiProperty(name: "unionMapProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"primitive\\":\\"string\\"},{\\"primitive\\":\\"number\\"},{\\"fqn\\":\\"@scope/jsii-calc-lib.Number\\"}]}},\\"kind\\":\\"map\\"}}")] public virtual System.Collections.Generic.IDictionary UnionMapProperty { get => GetInstanceProperty>()!; - set => SetInstanceProperty(value); + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + foreach (var __item_value in value) + { + if ( + !(__item_value.Value is string) + && !(__item_value.Value is byte || __item_value.Value is decimal || __item_value.Value is double || __item_value.Value is float || __item_value.Value is int || __item_value.Value is long || __item_value.Value is sbyte || __item_value.Value is short || __item_value.Value is uint || __item_value.Value is ulong || __item_value.Value is ushort) + && !(__item_value.Value is Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number) + ) + + { + throw new System.ArgumentException($"Expected value[\\"{__item_value.Key}\\"] to be one of: string, double, {typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number).FullName}; received {__item_value.Value.GetType().FullName}", $"value"); + } + } + } + SetInstanceProperty(value); + } } [JsiiProperty(name: "unionProperty", typeJson: "{\\"union\\":{\\"types\\":[{\\"primitive\\":\\"string\\"},{\\"primitive\\":\\"number\\"},{\\"fqn\\":\\"@scope/jsii-calc-lib.Number\\"},{\\"fqn\\":\\"jsii-calc.Multiply\\"}]}}")] public virtual object UnionProperty { get => GetInstanceProperty()!; - set => SetInstanceProperty(value); + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if ( + !(value is string) + && !(value is byte || value is decimal || value is double || value is float || value is int || value is long || value is sbyte || value is short || value is uint || value is ulong || value is ushort) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.Multiply) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: string, double, {typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Number).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.Multiply).FullName}; received {value.GetType().FullName}", $"value"); + } + } + SetInstanceProperty(value); + } } [JsiiProperty(name: "unknownArrayProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"primitive\\":\\"any\\"},\\"kind\\":\\"array\\"}}")] @@ -3672,8 +3816,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AllowedMethodNames), fullyQualifiedName: "jsii-calc.AllowedMethodNames")] public class AllowedMethodNames : DeputyBase { - public AllowedMethodNames(): base(new DeputyProps(System.Array.Empty())) + public AllowedMethodNames(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3730,8 +3880,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AmbiguousParameters), fullyQualifiedName: "jsii-calc.AmbiguousParameters", parametersJson: "[{\\"name\\":\\"scope\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.Bell\\"}},{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.StructParameterType\\"}}]")] public class AmbiguousParameters : DeputyBase { - public AmbiguousParameters(Amazon.JSII.Tests.CalculatorNamespace.Bell scope, Amazon.JSII.Tests.CalculatorNamespace.IStructParameterType props): base(new DeputyProps(new object?[]{scope, props})) + public AmbiguousParameters(Amazon.JSII.Tests.CalculatorNamespace.Bell scope, Amazon.JSII.Tests.CalculatorNamespace.IStructParameterType props): base(_MakeDeputyProps(scope, props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.Bell scope, Amazon.JSII.Tests.CalculatorNamespace.IStructParameterType props) { + return new DeputyProps(new object?[]{scope, props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3774,8 +3930,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AnonymousImplementationProvider), fullyQualifiedName: "jsii-calc.AnonymousImplementationProvider")] public class AnonymousImplementationProvider : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IAnonymousImplementationProvider { - public AnonymousImplementationProvider(): base(new DeputyProps(System.Array.Empty())) + public AnonymousImplementationProvider(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3818,10 +3980,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AsyncVirtualMethods), fullyQualifiedName: "jsii-calc.AsyncVirtualMethods")] public class AsyncVirtualMethods : DeputyBase { - public AsyncVirtualMethods(): base(new DeputyProps(System.Array.Empty())) + public AsyncVirtualMethods(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -3893,8 +4061,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.AugmentableClass), fullyQualifiedName: "jsii-calc.AugmentableClass")] public class AugmentableClass : DeputyBase { - public AugmentableClass(): base(new DeputyProps(System.Array.Empty())) + public AugmentableClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3937,8 +4111,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseClass), fullyQualifiedName: "jsii-calc.BaseClass")] public abstract class BaseClass : DeputyBase { - protected BaseClass(): base(new DeputyProps(System.Array.Empty())) + protected BaseClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -3989,8 +4169,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseJsii976), fullyQualifiedName: "jsii-calc.BaseJsii976")] public class BaseJsii976 : DeputyBase { - public BaseJsii976(): base(new DeputyProps(System.Array.Empty())) + public BaseJsii976(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4021,10 +4207,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Bell), fullyQualifiedName: "jsii-calc.Bell")] public class Bell : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IBell { - public Bell(): base(new DeputyProps(System.Array.Empty())) + public Bell(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -4070,8 +4262,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - protected BinaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(new DeputyProps(new object?[]{lhs, rhs})) + protected BinaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(_MakeDeputyProps(lhs, rhs)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs) { + return new DeputyProps(new object?[]{lhs, rhs}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4155,8 +4353,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.BurriedAnonymousObject), fullyQualifiedName: "jsii-calc.BurriedAnonymousObject")] public abstract class BurriedAnonymousObject : DeputyBase { - protected BurriedAnonymousObject(): base(new DeputyProps(System.Array.Empty())) + protected BurriedAnonymousObject(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4239,8 +4443,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Creates a Calculator object. /// Initialization properties. - public Calculator(Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps? props = null): base(new DeputyProps(new object?[]{props})) + public Calculator(Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps? props = null): base(_MakeDeputyProps(props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.ICalculatorProps? props = null) { + return new DeputyProps(new object?[]{props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4336,7 +4546,25 @@ namespace Amazon.JSII.Tests.CalculatorNamespace public virtual object? UnionProperty { get => GetInstanceProperty(); - set => SetInstanceProperty(value); + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if (value != null) + { + if ( + !(value is Amazon.JSII.Tests.CalculatorNamespace.Add) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.Multiply) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.Power) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.Add).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.Multiply).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.Power).FullName}; received {value.GetType().FullName}", $"value"); + } + } + } + SetInstanceProperty(value); + } } } } @@ -4394,8 +4622,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Cdk16625 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Cdk16625.Cdk16625), fullyQualifiedName: "jsii-calc.cdk16625.Cdk16625")] public abstract class Cdk16625 : DeputyBase { - protected Cdk16625(): base(new DeputyProps(System.Array.Empty())) + protected Cdk16625(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4463,8 +4697,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Cdk16625.Donotimport [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Cdk16625.Donotimport.UnimportedSubmoduleType), fullyQualifiedName: "jsii-calc.cdk16625.donotimport.UnimportedSubmoduleType", parametersJson: "[{\\"name\\":\\"value\\",\\"type\\":{\\"primitive\\":\\"number\\"}}]")] public class UnimportedSubmoduleType : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IRandomNumberGenerator { - public UnimportedSubmoduleType(double @value): base(new DeputyProps(new object?[]{@value})) + public UnimportedSubmoduleType(double @value): base(_MakeDeputyProps(@value)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double @value) { + return new DeputyProps(new object?[]{@value}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4533,10 +4773,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassThatImplementsTheInternalInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsTheInternalInterface")] public class ClassThatImplementsTheInternalInterface : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.INonInternalInterface { - public ClassThatImplementsTheInternalInterface(): base(new DeputyProps(System.Array.Empty())) + public ClassThatImplementsTheInternalInterface(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -4593,8 +4839,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassThatImplementsThePrivateInterface), fullyQualifiedName: "jsii-calc.ClassThatImplementsThePrivateInterface")] public class ClassThatImplementsThePrivateInterface : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.INonInternalInterface { - public ClassThatImplementsThePrivateInterface(): base(new DeputyProps(System.Array.Empty())) + public ClassThatImplementsThePrivateInterface(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4643,6 +4895,88 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithCollectionOfUnions.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithCollectionOfUnions), fullyQualifiedName: "jsii-calc.ClassWithCollectionOfUnions", parametersJson: "[{\\"name\\":\\"unionProperty\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}},\\"kind\\":\\"map\\"}},\\"kind\\":\\"array\\"}}}]")] + public class ClassWithCollectionOfUnions : DeputyBase + { + public ClassWithCollectionOfUnions(System.Collections.Generic.IDictionary[] unionProperty): base(_MakeDeputyProps(unionProperty)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(System.Collections.Generic.IDictionary[] unionProperty) + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + for (int __idx_argument__nameof_unionProperty__ = 0 ; __idx_argument__nameof_unionProperty__ < unionProperty.Length ; __idx_argument__nameof_unionProperty__++) + { + foreach (var __item_argument__nameof_unionProperty______idx_argument__nameof_unionProperty____ in unionProperty[__idx_argument__nameof_unionProperty__]) + { + if ( + !(__item_argument__nameof_unionProperty______idx_argument__nameof_unionProperty____.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructA) + && !(__item_argument__nameof_unionProperty______idx_argument__nameof_unionProperty____.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructB) + ) + + { + throw new System.ArgumentException($"Expected argument {nameof(unionProperty)}[{__idx_argument__nameof_unionProperty__}][\\"{__item_argument__nameof_unionProperty______idx_argument__nameof_unionProperty____.Key}\\"] to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructA).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructB).FullName}; received {__item_argument__nameof_unionProperty______idx_argument__nameof_unionProperty____.Value.GetType().FullName}", $"{nameof(unionProperty)}"); + } + } + } + } + return new DeputyProps(new object?[]{unionProperty}); + } + + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ClassWithCollectionOfUnions(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ClassWithCollectionOfUnions(DeputyProps props): base(props) + { + } + + [JsiiProperty(name: "unionProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}},\\"kind\\":\\"map\\"}},\\"kind\\":\\"array\\"}}")] + public virtual System.Collections.Generic.IDictionary[] UnionProperty + { + get => GetInstanceProperty[]>()!; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + for (int __idx_value = 0 ; __idx_value < value.Length ; __idx_value++) + { + foreach (var __item_value____idx_value__ in value[__idx_value]) + { + if ( + !(__item_value____idx_value__.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructA) + && !(__item_value____idx_value__.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructB) + ) + + { + throw new System.ArgumentException($"Expected value[{__idx_value}][\\"{__item_value____idx_value__.Key}\\"] to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructA).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructB).FullName}; received {__item_value____idx_value__.Value.GetType().FullName}", $"value"); + } + } + } + } + SetInstanceProperty(value); + } + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ClassWithCollections.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; @@ -4653,8 +4987,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithCollections), fullyQualifiedName: "jsii-calc.ClassWithCollections", parametersJson: "[{\\"name\\":\\"map\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"primitive\\":\\"string\\"},\\"kind\\":\\"map\\"}}},{\\"name\\":\\"array\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"primitive\\":\\"string\\"},\\"kind\\":\\"array\\"}}}]")] public class ClassWithCollections : DeputyBase { - public ClassWithCollections(System.Collections.Generic.IDictionary map, string[] array): base(new DeputyProps(new object?[]{map, array})) + public ClassWithCollections(System.Collections.Generic.IDictionary map, string[] array): base(_MakeDeputyProps(map, array)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(System.Collections.Generic.IDictionary map, string[] array) { + return new DeputyProps(new object?[]{map, array}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4725,8 +5065,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithContainerTypes), fullyQualifiedName: "jsii-calc.ClassWithContainerTypes", parametersJson: "[{\\"name\\":\\"array\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"fqn\\":\\"jsii-calc.DummyObj\\"},\\"kind\\":\\"array\\"}}},{\\"name\\":\\"record\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"fqn\\":\\"jsii-calc.DummyObj\\"},\\"kind\\":\\"map\\"}}},{\\"name\\":\\"obj\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"fqn\\":\\"jsii-calc.DummyObj\\"},\\"kind\\":\\"map\\"}}},{\\"name\\":\\"props\\",\\"optional\\":true,\\"type\\":{\\"fqn\\":\\"jsii-calc.ContainerProps\\"}}]")] public class ClassWithContainerTypes : DeputyBase { - public ClassWithContainerTypes(Amazon.JSII.Tests.CalculatorNamespace.IDummyObj[] array, System.Collections.Generic.IDictionary record, System.Collections.Generic.IDictionary obj, Amazon.JSII.Tests.CalculatorNamespace.IContainerProps? props = null): base(new DeputyProps(new object?[]{array, record, obj, props})) + public ClassWithContainerTypes(Amazon.JSII.Tests.CalculatorNamespace.IDummyObj[] array, System.Collections.Generic.IDictionary record, System.Collections.Generic.IDictionary obj, Amazon.JSII.Tests.CalculatorNamespace.IContainerProps? props = null): base(_MakeDeputyProps(array, record, obj, props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IDummyObj[] array, System.Collections.Generic.IDictionary record, System.Collections.Generic.IDictionary obj, Amazon.JSII.Tests.CalculatorNamespace.IContainerProps? props = null) { + return new DeputyProps(new object?[]{array, record, obj, props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4795,8 +5141,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithDocs), fullyQualifiedName: "jsii-calc.ClassWithDocs")] public class ClassWithDocs : DeputyBase { - public ClassWithDocs(): base(new DeputyProps(System.Array.Empty())) + public ClassWithDocs(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4827,10 +5179,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithJavaReservedWords), fullyQualifiedName: "jsii-calc.ClassWithJavaReservedWords", parametersJson: "[{\\"name\\":\\"int\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class ClassWithJavaReservedWords : DeputyBase { - public ClassWithJavaReservedWords(string @int): base(new DeputyProps(new object?[]{@int})) + public ClassWithJavaReservedWords(string @int): base(_MakeDeputyProps(@int)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string @int) + { + return new DeputyProps(new object?[]{@int}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -4871,8 +5229,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ClassWithMutableObjectLiteralProperty), fullyQualifiedName: "jsii-calc.ClassWithMutableObjectLiteralProperty")] public class ClassWithMutableObjectLiteralProperty : DeputyBase { - public ClassWithMutableObjectLiteralProperty(): base(new DeputyProps(System.Array.Empty())) + public ClassWithMutableObjectLiteralProperty(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -4959,8 +5323,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Composition [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Composition.CompositeOperation), fullyQualifiedName: "jsii-calc.composition.CompositeOperation")] public abstract class CompositeOperation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation { - protected CompositeOperation(): base(new DeputyProps(System.Array.Empty())) + protected CompositeOperation(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5105,7 +5475,24 @@ namespace Amazon.JSII.Tests.CalculatorNamespace public virtual object? UnionProperty { get => GetInstanceProperty(); - set => SetInstanceProperty(value); + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if (value != null) + { + if ( + !(value is Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IFriendly) + && !(value is object[]) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IFriendly).FullName}, {$"{"object"}[]"}; received {value.GetType().FullName}", $"value"); + } + } + } + SetInstanceProperty(value); + } } } } @@ -5122,12 +5509,31 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiByValue(fqn: "jsii-calc.ConfusingToJacksonStruct")] public class ConfusingToJacksonStruct : Amazon.JSII.Tests.CalculatorNamespace.IConfusingToJacksonStruct { + private object? _unionProperty; + [JsiiOptional] [JsiiProperty(name: "unionProperty", typeJson: "{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"@scope/jsii-calc-lib.IFriendly\\"},{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"@scope/jsii-calc-lib.IFriendly\\"},{\\"fqn\\":\\"jsii-calc.AbstractClass\\"}]}},\\"kind\\":\\"array\\"}}]}}", isOptional: true)] public object? UnionProperty { - get; - set; + get => _unionProperty; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if (value != null) + { + if ( + !(value is Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IFriendly) + && !(value is object[]) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IFriendly).FullName}, {$"{"object"}[]"}; received {value.GetType().FullName}", $"value"); + } + } + } + _unionProperty = value; + } } } } @@ -5144,8 +5550,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConstructorPassesThisOut), fullyQualifiedName: "jsii-calc.ConstructorPassesThisOut", parametersJson: "[{\\"name\\":\\"consumer\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.PartiallyInitializedThisConsumer\\"}}]")] public class ConstructorPassesThisOut : DeputyBase { - public ConstructorPassesThisOut(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer consumer): base(new DeputyProps(new object?[]{consumer})) + public ConstructorPassesThisOut(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer consumer): base(_MakeDeputyProps(consumer)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer consumer) { + return new DeputyProps(new object?[]{consumer}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5176,8 +5588,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Constructors), fullyQualifiedName: "jsii-calc.Constructors")] public class Constructors : DeputyBase { - public Constructors(): base(new DeputyProps(System.Array.Empty())) + public Constructors(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5250,8 +5668,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConsumePureInterface), fullyQualifiedName: "jsii-calc.ConsumePureInterface", parametersJson: "[{\\"name\\":\\"delegate\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.IStructReturningDelegate\\"}}]")] public class ConsumePureInterface : DeputyBase { - public ConsumePureInterface(Amazon.JSII.Tests.CalculatorNamespace.IStructReturningDelegate @delegate): base(new DeputyProps(new object?[]{@delegate})) + public ConsumePureInterface(Amazon.JSII.Tests.CalculatorNamespace.IStructReturningDelegate @delegate): base(_MakeDeputyProps(@delegate)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IStructReturningDelegate @delegate) { + return new DeputyProps(new object?[]{@delegate}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5293,10 +5717,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConsumerCanRingBell), fullyQualifiedName: "jsii-calc.ConsumerCanRingBell")] public class ConsumerCanRingBell : DeputyBase { - public ConsumerCanRingBell(): base(new DeputyProps(System.Array.Empty())) + public ConsumerCanRingBell(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -5405,8 +5835,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConsumersOfThisCrazyTypeSystem), fullyQualifiedName: "jsii-calc.ConsumersOfThisCrazyTypeSystem")] public class ConsumersOfThisCrazyTypeSystem : DeputyBase { - public ConsumersOfThisCrazyTypeSystem(): base(new DeputyProps(System.Array.Empty())) + public ConsumersOfThisCrazyTypeSystem(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5487,8 +5923,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DataRenderer), fullyQualifiedName: "jsii-calc.DataRenderer")] public class DataRenderer : DeputyBase { - public DataRenderer(): base(new DeputyProps(System.Array.Empty())) + public DataRenderer(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5541,8 +5983,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Default), fullyQualifiedName: "jsii-calc.Default")] public class Default : DeputyBase { - public Default(): base(new DeputyProps(System.Array.Empty())) + public Default(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5579,10 +6027,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DefaultedConstructorArgument), fullyQualifiedName: "jsii-calc.DefaultedConstructorArgument", parametersJson: "[{\\"name\\":\\"arg1\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"number\\"}},{\\"name\\":\\"arg2\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"string\\"}},{\\"name\\":\\"arg3\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"date\\"}}]")] public class DefaultedConstructorArgument : DeputyBase { - public DefaultedConstructorArgument(double? arg1 = null, string? arg2 = null, System.DateTime? arg3 = null): base(new DeputyProps(new object?[]{arg1, arg2, arg3})) + public DefaultedConstructorArgument(double? arg1 = null, string? arg2 = null, System.DateTime? arg3 = null): base(_MakeDeputyProps(arg1, arg2, arg3)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double? arg1 = null, string? arg2 = null, System.DateTime? arg3 = null) + { + return new DeputyProps(new object?[]{arg1, arg2, arg3}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -5635,8 +6089,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Demonstrate982), fullyQualifiedName: "jsii-calc.Demonstrate982")] public class Demonstrate982 : DeputyBase { - public Demonstrate982(): base(new DeputyProps(System.Array.Empty())) + public Demonstrate982(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5689,8 +6149,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Stability: Deprecated /// [System.Obsolete("this constructor is \\"just\\" okay")] - public DeprecatedClass(string readonlyString, double? mutableNumber = null): base(new DeputyProps(new object?[]{readonlyString, mutableNumber})) + public DeprecatedClass(string readonlyString, double? mutableNumber = null): base(_MakeDeputyProps(readonlyString, mutableNumber)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string readonlyString, double? mutableNumber = null) { + return new DeputyProps(new object?[]{readonlyString, mutableNumber}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5817,8 +6283,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Base), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Base")] public class Base : DeputyBase { - public Base(): base(new DeputyProps(System.Array.Empty())) + public Base(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -5856,10 +6328,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Derived), fullyQualifiedName: "jsii-calc.DerivedClassHasNoProperties.Derived")] public class Derived : Amazon.JSII.Tests.CalculatorNamespace.DerivedClassHasNoProperties.Base { - public Derived(): base(new DeputyProps(System.Array.Empty())) + public Derived(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -6227,8 +6705,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoNotOverridePrivates), fullyQualifiedName: "jsii-calc.DoNotOverridePrivates")] public class DoNotOverridePrivates : DeputyBase { - public DoNotOverridePrivates(): base(new DeputyProps(System.Array.Empty())) + public DoNotOverridePrivates(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6278,8 +6762,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoNotRecognizeAnyAsOptional), fullyQualifiedName: "jsii-calc.DoNotRecognizeAnyAsOptional")] public class DoNotRecognizeAnyAsOptional : DeputyBase { - public DoNotRecognizeAnyAsOptional(): base(new DeputyProps(System.Array.Empty())) + public DoNotRecognizeAnyAsOptional(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6332,8 +6822,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DocumentedClass), fullyQualifiedName: "jsii-calc.DocumentedClass")] public class DocumentedClass : DeputyBase { - public DocumentedClass(): base(new DeputyProps(System.Array.Empty())) + public DocumentedClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6387,10 +6883,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DontComplainAboutVariadicAfterOptional), fullyQualifiedName: "jsii-calc.DontComplainAboutVariadicAfterOptional")] public class DontComplainAboutVariadicAfterOptional : DeputyBase { - public DontComplainAboutVariadicAfterOptional(): base(new DeputyProps(System.Array.Empty())) + public DontComplainAboutVariadicAfterOptional(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -6425,8 +6927,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DoubleTrouble), fullyQualifiedName: "jsii-calc.DoubleTrouble")] public class DoubleTrouble : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IFriendlyRandomGenerator { - public DoubleTrouble(): base(new DeputyProps(System.Array.Empty())) + public DoubleTrouble(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6495,8 +7003,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DynamicPropertyBearer), fullyQualifiedName: "jsii-calc.DynamicPropertyBearer", parametersJson: "[{\\"name\\":\\"valueStore\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class DynamicPropertyBearer : DeputyBase { - public DynamicPropertyBearer(string valueStore): base(new DeputyProps(new object?[]{valueStore})) + public DynamicPropertyBearer(string valueStore): base(_MakeDeputyProps(valueStore)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string valueStore) { + return new DeputyProps(new object?[]{valueStore}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6541,8 +7055,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.DynamicPropertyBearerChild), fullyQualifiedName: "jsii-calc.DynamicPropertyBearerChild", parametersJson: "[{\\"name\\":\\"originalValue\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class DynamicPropertyBearerChild : Amazon.JSII.Tests.CalculatorNamespace.DynamicPropertyBearer { - public DynamicPropertyBearerChild(string originalValue): base(new DeputyProps(new object?[]{originalValue})) + public DynamicPropertyBearerChild(string originalValue): base(_MakeDeputyProps(originalValue)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string originalValue) { + return new DeputyProps(new object?[]{originalValue}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6591,10 +7111,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// Creates a new instance of Entropy. /// your implementation of \`WallClock\`. - protected Entropy(Amazon.JSII.Tests.CalculatorNamespace.IWallClock clock): base(new DeputyProps(new object?[]{clock})) + protected Entropy(Amazon.JSII.Tests.CalculatorNamespace.IWallClock clock): base(_MakeDeputyProps(clock)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IWallClock clock) + { + return new DeputyProps(new object?[]{clock}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -6696,8 +7222,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.EraseUndefinedHashValues), fullyQualifiedName: "jsii-calc.EraseUndefinedHashValues")] public class EraseUndefinedHashValues : DeputyBase { - public EraseUndefinedHashValues(): base(new DeputyProps(System.Array.Empty())) + public EraseUndefinedHashValues(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6789,8 +7321,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// /// Stability: Experimental /// - public ExperimentalClass(string readonlyString, double? mutableNumber = null): base(new DeputyProps(new object?[]{readonlyString, mutableNumber})) + public ExperimentalClass(string readonlyString, double? mutableNumber = null): base(_MakeDeputyProps(readonlyString, mutableNumber)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string readonlyString, double? mutableNumber = null) { + return new DeputyProps(new object?[]{readonlyString, mutableNumber}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6908,8 +7446,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ExportedBaseClass), fullyQualifiedName: "jsii-calc.ExportedBaseClass", parametersJson: "[{\\"name\\":\\"success\\",\\"type\\":{\\"primitive\\":\\"boolean\\"}}]")] public class ExportedBaseClass : DeputyBase { - public ExportedBaseClass(bool success): base(new DeputyProps(new object?[]{success})) + public ExportedBaseClass(bool success): base(_MakeDeputyProps(success)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(bool success) { + return new DeputyProps(new object?[]{success}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -6982,10 +7526,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// /// External: true /// - public ExternalClass(string readonlyString, double? mutableNumber = null): base(new DeputyProps(new object?[]{readonlyString, mutableNumber})) + public ExternalClass(string readonlyString, double? mutableNumber = null): base(_MakeDeputyProps(readonlyString, mutableNumber)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string readonlyString, double? mutableNumber = null) + { + return new DeputyProps(new object?[]{readonlyString, mutableNumber}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -7129,8 +7679,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.GiveMeStructs), fullyQualifiedName: "jsii-calc.GiveMeStructs")] public class GiveMeStructs : DeputyBase { - public GiveMeStructs(): base(new DeputyProps(System.Array.Empty())) + public GiveMeStructs(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -7215,10 +7771,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.GreetingAugmenter), fullyQualifiedName: "jsii-calc.GreetingAugmenter")] public class GreetingAugmenter : DeputyBase { - public GreetingAugmenter(): base(new DeputyProps(System.Array.Empty())) + public GreetingAugmenter(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -11003,6 +11565,40 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStructWithCollectionOfUnionts.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + [JsiiInterface(nativeType: typeof(IStructWithCollectionOfUnionts), fullyQualifiedName: "jsii-calc.StructWithCollectionOfUnionts")] + public interface IStructWithCollectionOfUnionts + { + [JsiiProperty(name: "unionProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}},\\"kind\\":\\"map\\"}},\\"kind\\":\\"array\\"}}")] + System.Collections.Generic.IDictionary[] UnionProperty + { + get; + } + + [JsiiTypeProxy(nativeType: typeof(IStructWithCollectionOfUnionts), fullyQualifiedName: "jsii-calc.StructWithCollectionOfUnionts")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IStructWithCollectionOfUnionts + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiProperty(name: "unionProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}},\\"kind\\":\\"map\\"}},\\"kind\\":\\"array\\"}}")] + public System.Collections.Generic.IDictionary[] UnionProperty + { + get => GetInstanceProperty[]>()!; + } + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IStructWithEnum.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; @@ -11375,8 +11971,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementInternalInterface), fullyQualifiedName: "jsii-calc.ImplementInternalInterface")] public class ImplementInternalInterface : DeputyBase { - public ImplementInternalInterface(): base(new DeputyProps(System.Array.Empty())) + public ImplementInternalInterface(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11414,8 +12016,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Implementation), fullyQualifiedName: "jsii-calc.Implementation")] public class Implementation : DeputyBase { - public Implementation(): base(new DeputyProps(System.Array.Empty())) + public Implementation(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11452,10 +12060,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternal), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternal")] public class ImplementsInterfaceWithInternal : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithInternal { - public ImplementsInterfaceWithInternal(): base(new DeputyProps(System.Array.Empty())) + public ImplementsInterfaceWithInternal(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -11490,8 +12104,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternalSubclass), fullyQualifiedName: "jsii-calc.ImplementsInterfaceWithInternalSubclass")] public class ImplementsInterfaceWithInternalSubclass : Amazon.JSII.Tests.CalculatorNamespace.ImplementsInterfaceWithInternal { - public ImplementsInterfaceWithInternalSubclass(): base(new DeputyProps(System.Array.Empty())) + public ImplementsInterfaceWithInternalSubclass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11522,10 +12142,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ImplementsPrivateInterface), fullyQualifiedName: "jsii-calc.ImplementsPrivateInterface")] public class ImplementsPrivateInterface : DeputyBase { - public ImplementsPrivateInterface(): base(new DeputyProps(System.Array.Empty())) + public ImplementsPrivateInterface(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -11598,8 +12224,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.InbetweenClass), fullyQualifiedName: "jsii-calc.InbetweenClass")] public class InbetweenClass : Amazon.JSII.Tests.CalculatorNamespace.PublicClass, Amazon.JSII.Tests.CalculatorNamespace.IPublicInterface2 { - public InbetweenClass(): base(new DeputyProps(System.Array.Empty())) + public InbetweenClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11692,10 +12324,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClas [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.InterfaceInNamespaceIncludesClasses.Foo), fullyQualifiedName: "jsii-calc.InterfaceInNamespaceIncludesClasses.Foo")] public class Foo : DeputyBase { - public Foo(): base(new DeputyProps(System.Array.Empty())) + public Foo(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -11903,8 +12541,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Isomorphism), fullyQualifiedName: "jsii-calc.Isomorphism")] public abstract class Isomorphism : DeputyBase { - protected Isomorphism(): base(new DeputyProps(System.Array.Empty())) + protected Isomorphism(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11962,8 +12606,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// /// Second sentence. Third sentence. /// - public Issue2638(): base(new DeputyProps(System.Array.Empty())) + public Issue2638(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -11994,10 +12644,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Issue2638B), fullyQualifiedName: "jsii-calc.Issue2638B")] public class Issue2638B : DeputyBase { - public Issue2638B(): base(new DeputyProps(System.Array.Empty())) + public Issue2638B(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -12026,10 +12682,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSII417Derived), fullyQualifiedName: "jsii-calc.JSII417Derived", parametersJson: "[{\\"name\\":\\"property\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class JSII417Derived : Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase { - public JSII417Derived(string property): base(new DeputyProps(new object?[]{property})) + public JSII417Derived(string property): base(_MakeDeputyProps(property)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string property) + { + return new DeputyProps(new object?[]{property}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -12076,8 +12738,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSII417PublicBaseOfBase), fullyQualifiedName: "jsii-calc.JSII417PublicBaseOfBase")] public class JSII417PublicBaseOfBase : DeputyBase { - public JSII417PublicBaseOfBase(): base(new DeputyProps(System.Array.Empty())) + public JSII417PublicBaseOfBase(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12126,8 +12794,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralForInterface), fullyQualifiedName: "jsii-calc.JSObjectLiteralForInterface")] public class JSObjectLiteralForInterface : DeputyBase { - public JSObjectLiteralForInterface(): base(new DeputyProps(System.Array.Empty())) + public JSObjectLiteralForInterface(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12170,10 +12844,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralToNative), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNative")] public class JSObjectLiteralToNative : DeputyBase { - public JSObjectLiteralToNative(): base(new DeputyProps(System.Array.Empty())) + public JSObjectLiteralToNative(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -12208,8 +12888,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JSObjectLiteralToNativeClass), fullyQualifiedName: "jsii-calc.JSObjectLiteralToNativeClass")] public class JSObjectLiteralToNativeClass : DeputyBase { - public JSObjectLiteralToNativeClass(): base(new DeputyProps(System.Array.Empty())) + public JSObjectLiteralToNativeClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12254,10 +12940,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JavaReservedWords), fullyQualifiedName: "jsii-calc.JavaReservedWords")] public class JavaReservedWords : DeputyBase { - public JavaReservedWords(): base(new DeputyProps(System.Array.Empty())) + public JavaReservedWords(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -12605,8 +13297,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Jsii487Derived), fullyQualifiedName: "jsii-calc.Jsii487Derived")] public class Jsii487Derived : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IJsii487External2, Amazon.JSII.Tests.CalculatorNamespace.IJsii487External { - public Jsii487Derived(): base(new DeputyProps(System.Array.Empty())) + public Jsii487Derived(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12637,10 +13335,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Jsii496Derived), fullyQualifiedName: "jsii-calc.Jsii496Derived")] public class Jsii496Derived : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IJsii496 { - public Jsii496Derived(): base(new DeputyProps(System.Array.Empty())) + public Jsii496Derived(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -12751,8 +13455,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Jsii3656 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Jsii3656.OverrideMe), fullyQualifiedName: "jsii-calc.jsii3656.OverrideMe")] public abstract class OverrideMe : DeputyBase { - protected OverrideMe(): base(new DeputyProps(System.Array.Empty())) + protected OverrideMe(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12808,8 +13518,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.JsiiAgent), fullyQualifiedName: "jsii-calc.JsiiAgent")] public class JsiiAgent : DeputyBase { - public JsiiAgent(): base(new DeputyProps(System.Array.Empty())) + public JsiiAgent(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -12965,8 +13681,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LevelOne), fullyQualifiedName: "jsii-calc.LevelOne", parametersJson: "[{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.LevelOneProps\\"}}]")] public class LevelOne : DeputyBase { - public LevelOne(Amazon.JSII.Tests.CalculatorNamespace.ILevelOneProps props): base(new DeputyProps(new object?[]{props})) + public LevelOne(Amazon.JSII.Tests.CalculatorNamespace.ILevelOneProps props): base(_MakeDeputyProps(props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.ILevelOneProps props) { + return new DeputyProps(new object?[]{props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -13197,8 +13919,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.MethodNamedProperty), fullyQualifiedName: "jsii-calc.MethodNamedProperty")] public class MethodNamedProperty : DeputyBase { - public MethodNamedProperty(): base(new DeputyProps(System.Array.Empty())) + public MethodNamedProperty(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -13245,10 +13973,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2530 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2530.MyClass), fullyQualifiedName: "jsii-calc.module2530.MyClass", parametersJson: "[{\\"name\\":\\"_\\",\\"type\\":{\\"primitive\\":\\"number\\"}}]")] public class MyClass : DeputyBase { - public MyClass(double _): base(new DeputyProps(new object?[]{_})) + public MyClass(double _): base(_MakeDeputyProps(_)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double _) + { + return new DeputyProps(new object?[]{_}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13337,8 +14071,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2647 /// Stability: Deprecated /// [System.Obsolete()] - public ExtendAndImplement(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(new DeputyProps(new object?[]{very})) + public ExtendAndImplement(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(_MakeDeputyProps(very)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very) { + return new DeputyProps(new object?[]{very}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -13384,10 +14124,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2689.Methods [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2689.Methods.MyClass), fullyQualifiedName: "jsii-calc.module2689.methods.MyClass")] public class MyClass : DeputyBase { - public MyClass(): base(new DeputyProps(System.Array.Empty())) + public MyClass(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13428,10 +14174,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2689.Props [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2689.Props.MyClass), fullyQualifiedName: "jsii-calc.module2689.props.MyClass")] public class MyClass : DeputyBase { - public MyClass(): base(new DeputyProps(System.Array.Empty())) + public MyClass(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13472,10 +14224,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2689.Retval [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2689.Retval.MyClass), fullyQualifiedName: "jsii-calc.module2689.retval.MyClass")] public class MyClass : DeputyBase { - public MyClass(): base(new DeputyProps(System.Array.Empty())) + public MyClass(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13789,8 +14547,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2700 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2700.Base), fullyQualifiedName: "jsii-calc.module2700.Base")] public class Base : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.Module2700.IFoo { - public Base(): base(new DeputyProps(System.Array.Empty())) + public Base(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -13833,10 +14597,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2700 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2700.Derived), fullyQualifiedName: "jsii-calc.module2700.Derived")] public class Derived : Amazon.JSII.Tests.CalculatorNamespace.Module2700.Base, Amazon.JSII.Tests.CalculatorNamespace.Module2700.IFoo { - public Derived(): base(new DeputyProps(System.Array.Empty())) + public Derived(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13913,8 +14683,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Baz), fullyQualifiedName: "jsii-calc.module2702.Baz")] public class Baz : Amazon.JSII.Tests.CalculatorNamespace.Module2702.Class3, Amazon.JSII.Tests.CalculatorNamespace.Module2702.IBaz { - public Baz(): base(new DeputyProps(System.Array.Empty())) + public Baz(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -13951,10 +14727,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Class1), fullyQualifiedName: "jsii-calc.module2702.Class1")] public class Class1 : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base { - public Class1(): base(new DeputyProps(System.Array.Empty())) + public Class1(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -13989,8 +14771,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Class2), fullyQualifiedName: "jsii-calc.module2702.Class2")] public class Class2 : Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.Base { - public Class2(): base(new DeputyProps(System.Array.Empty())) + public Class2(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14027,10 +14815,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Class3), fullyQualifiedName: "jsii-calc.module2702.Class3")] public class Class3 : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.IBaseInterface { - public Class3(): base(new DeputyProps(System.Array.Empty())) + public Class3(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14077,10 +14871,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Construct), fullyQualifiedName: "jsii-calc.module2702.Construct")] public class Construct : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.Module2702.IConstruct { - public Construct(): base(new DeputyProps(System.Array.Empty())) + public Construct(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14315,8 +15115,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Resource), fullyQualifiedName: "jsii-calc.module2702.Resource")] public abstract class Resource : Amazon.JSII.Tests.CalculatorNamespace.Module2702.Construct, Amazon.JSII.Tests.CalculatorNamespace.Module2702.IResource { - protected Resource(): base(new DeputyProps(System.Array.Empty())) + protected Resource(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14367,10 +15173,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Module2702 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2702.Vpc), fullyQualifiedName: "jsii-calc.module2702.Vpc")] public class Vpc : Amazon.JSII.Tests.CalculatorNamespace.Module2702.Resource, Amazon.JSII.Tests.CalculatorNamespace.Module2702.IVpc { - public Vpc(): base(new DeputyProps(System.Array.Empty())) + public Vpc(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14409,10 +15221,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Creates a BinaryOperation. /// Left-hand side operand. /// Right-hand side operand. - public Multiply(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(new DeputyProps(new object?[]{lhs, rhs})) + public Multiply(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs): base(_MakeDeputyProps(lhs, rhs)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue lhs, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue rhs) + { + return new DeputyProps(new object?[]{lhs, rhs}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14516,8 +15334,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Negate), fullyQualifiedName: "jsii-calc.Negate", parametersJson: "[{\\"name\\":\\"operand\\",\\"type\\":{\\"fqn\\":\\"@scope/jsii-calc-lib.NumericValue\\"}}]")] public class Negate : Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation, Amazon.JSII.Tests.CalculatorNamespace.IFriendlier { - public Negate(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand): base(new DeputyProps(new object?[]{operand})) + public Negate(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand): base(_MakeDeputyProps(operand)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand) { + return new DeputyProps(new object?[]{operand}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14642,8 +15466,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NodeStandardLibrary), fullyQualifiedName: "jsii-calc.NodeStandardLibrary")] public class NodeStandardLibrary : DeputyBase { - public NodeStandardLibrary(): base(new DeputyProps(System.Array.Empty())) + public NodeStandardLibrary(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14705,10 +15535,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Nodirect.Sub1 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Nodirect.Sub1.TypeFromSub1), fullyQualifiedName: "jsii-calc.nodirect.sub1.TypeFromSub1")] public class TypeFromSub1 : DeputyBase { - public TypeFromSub1(): base(new DeputyProps(System.Array.Empty())) + public TypeFromSub1(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14743,8 +15579,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Nodirect.Sub2 [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Nodirect.Sub2.TypeFromSub2), fullyQualifiedName: "jsii-calc.nodirect.sub2.TypeFromSub2")] public class TypeFromSub2 : DeputyBase { - public TypeFromSub2(): base(new DeputyProps(System.Array.Empty())) + public TypeFromSub2(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14782,10 +15624,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NullShouldBeTreatedAsUndefined), fullyQualifiedName: "jsii-calc.NullShouldBeTreatedAsUndefined", parametersJson: "[{\\"name\\":\\"_param1\\",\\"type\\":{\\"primitive\\":\\"string\\"}},{\\"name\\":\\"optional\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"any\\"}}]")] public class NullShouldBeTreatedAsUndefined : DeputyBase { - public NullShouldBeTreatedAsUndefined(string param1, object? optional = null): base(new DeputyProps(new object?[]{param1, optional})) + public NullShouldBeTreatedAsUndefined(string param1, object? optional = null): base(_MakeDeputyProps(param1, optional)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string param1, object? optional = null) + { + return new DeputyProps(new object?[]{param1, optional}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -14872,8 +15720,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.NumberGenerator), fullyQualifiedName: "jsii-calc.NumberGenerator", parametersJson: "[{\\"name\\":\\"generator\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.IRandomNumberGenerator\\"}}]")] public class NumberGenerator : DeputyBase { - public NumberGenerator(Amazon.JSII.Tests.CalculatorNamespace.IRandomNumberGenerator generator): base(new DeputyProps(new object?[]{generator})) + public NumberGenerator(Amazon.JSII.Tests.CalculatorNamespace.IRandomNumberGenerator generator): base(_MakeDeputyProps(generator)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IRandomNumberGenerator generator) { + return new DeputyProps(new object?[]{generator}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -14924,10 +15778,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ObjectRefsInCollections), fullyQualifiedName: "jsii-calc.ObjectRefsInCollections")] public class ObjectRefsInCollections : DeputyBase { - public ObjectRefsInCollections(): base(new DeputyProps(System.Array.Empty())) + public ObjectRefsInCollections(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15009,8 +15869,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [System.Obsolete("Use the new class or the old class whatever you want because whatever you like is always the best")] public class Old : DeputyBase { - public Old(): base(new DeputyProps(System.Array.Empty())) + public Old(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15087,8 +15953,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OptionalArgumentInvoker), fullyQualifiedName: "jsii-calc.OptionalArgumentInvoker", parametersJson: "[{\\"name\\":\\"delegate\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.IInterfaceWithOptionalMethodArguments\\"}}]")] public class OptionalArgumentInvoker : DeputyBase { - public OptionalArgumentInvoker(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithOptionalMethodArguments @delegate): base(new DeputyProps(new object?[]{@delegate})) + public OptionalArgumentInvoker(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithOptionalMethodArguments @delegate): base(_MakeDeputyProps(@delegate)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithOptionalMethodArguments @delegate) { + return new DeputyProps(new object?[]{@delegate}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15131,10 +16003,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OptionalConstructorArgument), fullyQualifiedName: "jsii-calc.OptionalConstructorArgument", parametersJson: "[{\\"name\\":\\"arg1\\",\\"type\\":{\\"primitive\\":\\"number\\"}},{\\"name\\":\\"arg2\\",\\"type\\":{\\"primitive\\":\\"string\\"}},{\\"name\\":\\"arg3\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"date\\"}}]")] public class OptionalConstructorArgument : DeputyBase { - public OptionalConstructorArgument(double arg1, string arg2, System.DateTime? arg3 = null): base(new DeputyProps(new object?[]{arg1, arg2, arg3})) + public OptionalConstructorArgument(double arg1, string arg2, System.DateTime? arg3 = null): base(_MakeDeputyProps(arg1, arg2, arg3)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double arg1, string arg2, System.DateTime? arg3 = null) + { + return new DeputyProps(new object?[]{arg1, arg2, arg3}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15204,10 +16082,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OptionalStructConsumer), fullyQualifiedName: "jsii-calc.OptionalStructConsumer", parametersJson: "[{\\"name\\":\\"optionalStruct\\",\\"optional\\":true,\\"type\\":{\\"fqn\\":\\"jsii-calc.OptionalStruct\\"}}]")] public class OptionalStructConsumer : DeputyBase { - public OptionalStructConsumer(Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct? optionalStruct = null): base(new DeputyProps(new object?[]{optionalStruct})) + public OptionalStructConsumer(Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct? optionalStruct = null): base(_MakeDeputyProps(optionalStruct)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IOptionalStruct? optionalStruct = null) + { + return new DeputyProps(new object?[]{optionalStruct}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15252,8 +16136,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OverridableProtectedMember), fullyQualifiedName: "jsii-calc.OverridableProtectedMember")] public class OverridableProtectedMember : DeputyBase { - public OverridableProtectedMember(): base(new DeputyProps(System.Array.Empty())) + public OverridableProtectedMember(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15315,8 +16205,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.OverrideReturnsObject), fullyQualifiedName: "jsii-calc.OverrideReturnsObject")] public class OverrideReturnsObject : DeputyBase { - public OverrideReturnsObject(): base(new DeputyProps(System.Array.Empty())) + public OverrideReturnsObject(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15377,8 +16273,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PartiallyInitializedThisConsumer), fullyQualifiedName: "jsii-calc.PartiallyInitializedThisConsumer")] public abstract class PartiallyInitializedThisConsumer : DeputyBase { - protected PartiallyInitializedThisConsumer(): base(new DeputyProps(System.Array.Empty())) + protected PartiallyInitializedThisConsumer(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15427,8 +16329,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Polymorphism), fullyQualifiedName: "jsii-calc.Polymorphism")] public class Polymorphism : DeputyBase { - public Polymorphism(): base(new DeputyProps(System.Array.Empty())) + public Polymorphism(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15469,10 +16377,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// Creates a Power operation. /// The base of the power. /// The number of times to multiply. - public Power(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue @base, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue pow): base(new DeputyProps(new object?[]{@base, pow})) + public Power(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue @base, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue pow): base(_MakeDeputyProps(@base, pow)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue @base, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue pow) + { + return new DeputyProps(new object?[]{@base, pow}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15526,8 +16440,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PropertyNamedProperty), fullyQualifiedName: "jsii-calc.PropertyNamedProperty")] public class PropertyNamedProperty : DeputyBase { - public PropertyNamedProperty(): base(new DeputyProps(System.Array.Empty())) + public PropertyNamedProperty(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15570,10 +16490,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PublicClass), fullyQualifiedName: "jsii-calc.PublicClass")] public class PublicClass : DeputyBase { - public PublicClass(): base(new DeputyProps(System.Array.Empty())) + public PublicClass(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15608,8 +16534,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PythonReservedWords), fullyQualifiedName: "jsii-calc.PythonReservedWords")] public class PythonReservedWords : DeputyBase { - public PythonReservedWords(): base(new DeputyProps(System.Array.Empty())) + public PythonReservedWords(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -15832,10 +16764,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.PythonSelf [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PythonSelf.ClassWithSelf), fullyQualifiedName: "jsii-calc.PythonSelf.ClassWithSelf", parametersJson: "[{\\"name\\":\\"self\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class ClassWithSelf : DeputyBase { - public ClassWithSelf(string self): base(new DeputyProps(new object?[]{self})) + public ClassWithSelf(string self): base(_MakeDeputyProps(self)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string self) + { + return new DeputyProps(new object?[]{self}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -15876,8 +16814,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.PythonSelf [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.PythonSelf.ClassWithSelfKwarg), fullyQualifiedName: "jsii-calc.PythonSelf.ClassWithSelfKwarg", parametersJson: "[{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.PythonSelf.StructWithSelf\\"}}]")] public class ClassWithSelfKwarg : DeputyBase { - public ClassWithSelfKwarg(Amazon.JSII.Tests.CalculatorNamespace.PythonSelf.IStructWithSelf props): base(new DeputyProps(new object?[]{props})) + public ClassWithSelfKwarg(Amazon.JSII.Tests.CalculatorNamespace.PythonSelf.IStructWithSelf props): base(_MakeDeputyProps(props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.PythonSelf.IStructWithSelf props) { + return new DeputyProps(new object?[]{props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -16003,10 +16947,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ReferenceEnumFromScopedPackage), fullyQualifiedName: "jsii-calc.ReferenceEnumFromScopedPackage")] public class ReferenceEnumFromScopedPackage : DeputyBase { - public ReferenceEnumFromScopedPackage(): base(new DeputyProps(System.Array.Empty())) + public ReferenceEnumFromScopedPackage(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -16060,8 +17010,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ReturnsPrivateImplementationOfInterface), fullyQualifiedName: "jsii-calc.ReturnsPrivateImplementationOfInterface")] public class ReturnsPrivateImplementationOfInterface : DeputyBase { - public ReturnsPrivateImplementationOfInterface(): base(new DeputyProps(System.Array.Empty())) + public ReturnsPrivateImplementationOfInterface(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -16169,8 +17125,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.RuntimeTypeChecking), fullyQualifiedName: "jsii-calc.RuntimeTypeChecking")] public class RuntimeTypeChecking : DeputyBase { - public RuntimeTypeChecking(): base(new DeputyProps(System.Array.Empty())) + public RuntimeTypeChecking(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -16259,10 +17221,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SingleInstanceTwoTypes), fullyQualifiedName: "jsii-calc.SingleInstanceTwoTypes")] public class SingleInstanceTwoTypes : DeputyBase { - public SingleInstanceTwoTypes(): base(new DeputyProps(System.Array.Empty())) + public SingleInstanceTwoTypes(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -16449,10 +17417,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SomeTypeJsii976), fullyQualifiedName: "jsii-calc.SomeTypeJsii976")] public class SomeTypeJsii976 : DeputyBase { - public SomeTypeJsii976(): base(new DeputyProps(System.Array.Empty())) + public SomeTypeJsii976(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -16493,10 +17467,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StableClass), fullyQualifiedName: "jsii-calc.StableClass", parametersJson: "[{\\"name\\":\\"readonlyString\\",\\"type\\":{\\"primitive\\":\\"string\\"}},{\\"name\\":\\"mutableNumber\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"number\\"}}]")] public class StableClass : DeputyBase { - public StableClass(string readonlyString, double? mutableNumber = null): base(new DeputyProps(new object?[]{readonlyString, mutableNumber})) + public StableClass(string readonlyString, double? mutableNumber = null): base(_MakeDeputyProps(readonlyString, mutableNumber)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string readonlyString, double? mutableNumber = null) + { + return new DeputyProps(new object?[]{readonlyString, mutableNumber}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -16679,8 +17659,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StaticHelloParent), fullyQualifiedName: "jsii-calc.StaticHelloParent")] public class StaticHelloParent : DeputyBase { - public StaticHelloParent(): base(new DeputyProps(System.Array.Empty())) + public StaticHelloParent(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -16723,10 +17709,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Statics), fullyQualifiedName: "jsii-calc.Statics", parametersJson: "[{\\"name\\":\\"value\\",\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class Statics : DeputyBase { - public Statics(string @value): base(new DeputyProps(new object?[]{@value})) + public Statics(string @value): base(_MakeDeputyProps(@value)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string @value) + { + return new DeputyProps(new object?[]{@value}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -16846,8 +17838,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StripInternal), fullyQualifiedName: "jsii-calc.StripInternal")] public class StripInternal : DeputyBase { - public StripInternal(): base(new DeputyProps(System.Array.Empty())) + public StripInternal(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -17001,10 +17999,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.StructPassing), fullyQualifiedName: "jsii-calc.StructPassing")] public class StructPassing : DeputyBase { - public StructPassing(): base(new DeputyProps(System.Array.Empty())) + public StructPassing(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -17062,12 +18066,34 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiMethod(name: "isStructA", returnsJson: "{\\"type\\":{\\"primitive\\":\\"boolean\\"}}", parametersJson: "[{\\"name\\":\\"struct\\",\\"type\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}}}]")] public static bool IsStructA(object @struct) { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if ( + !(@struct is Amazon.JSII.Tests.CalculatorNamespace.IStructA) + && !(@struct is Amazon.JSII.Tests.CalculatorNamespace.IStructB) + ) + + { + throw new System.ArgumentException($"Expected argument {nameof(@struct)} to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructA).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructB).FullName}; received {@struct.GetType().FullName}", $"{nameof(@struct)}"); + } + } return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.StructUnionConsumer), new System.Type[]{typeof(object)}, new object[]{@struct})!; } [JsiiMethod(name: "isStructB", returnsJson: "{\\"type\\":{\\"primitive\\":\\"boolean\\"}}", parametersJson: "[{\\"name\\":\\"struct\\",\\"type\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}}}]")] public static bool IsStructB(object @struct) { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if ( + !(@struct is Amazon.JSII.Tests.CalculatorNamespace.IStructA) + && !(@struct is Amazon.JSII.Tests.CalculatorNamespace.IStructB) + ) + + { + throw new System.ArgumentException($"Expected argument {nameof(@struct)} to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructA).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructB).FullName}; received {@struct.GetType().FullName}", $"{nameof(@struct)}"); + } + } return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.StructUnionConsumer), new System.Type[]{typeof(object)}, new object[]{@struct})!; } } @@ -17075,6 +18101,51 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructWithCollectionOfUnionts.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + #pragma warning disable CS8618 + + [JsiiByValue(fqn: "jsii-calc.StructWithCollectionOfUnionts")] + public class StructWithCollectionOfUnionts : Amazon.JSII.Tests.CalculatorNamespace.IStructWithCollectionOfUnionts + { + private System.Collections.Generic.IDictionary[] _unionProperty; + + [JsiiProperty(name: "unionProperty", typeJson: "{\\"collection\\":{\\"elementtype\\":{\\"collection\\":{\\"elementtype\\":{\\"union\\":{\\"types\\":[{\\"fqn\\":\\"jsii-calc.StructA\\"},{\\"fqn\\":\\"jsii-calc.StructB\\"}]}},\\"kind\\":\\"map\\"}},\\"kind\\":\\"array\\"}}")] + public System.Collections.Generic.IDictionary[] UnionProperty + { + get => _unionProperty; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + for (int __idx_value = 0 ; __idx_value < value.Length ; __idx_value++) + { + foreach (var __item_value____idx_value__ in value[__idx_value]) + { + if ( + !(__item_value____idx_value__.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructA) + && !(__item_value____idx_value__.Value is Amazon.JSII.Tests.CalculatorNamespace.IStructB) + ) + + { + throw new System.ArgumentException($"Expected value[{__idx_value}][\\"{__item_value____idx_value__.Key}\\"] to be one of: {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructA).FullName}, {typeof(Amazon.JSII.Tests.CalculatorNamespace.IStructB).FullName}; received {__item_value____idx_value__.Value.GetType().FullName}", $"value"); + } + } + } + } + _unionProperty = value; + } + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/StructWithEnum.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; @@ -17382,8 +18453,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child.InnerClass), fullyQualifiedName: "jsii-calc.submodule.child.InnerClass")] public class InnerClass : DeputyBase { - public InnerClass(): base(new DeputyProps(System.Array.Empty())) + public InnerClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -17454,8 +18531,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child.OuterClass), fullyQualifiedName: "jsii-calc.submodule.child.OuterClass")] public class OuterClass : DeputyBase { - public OuterClass(): base(new DeputyProps(System.Array.Empty())) + public OuterClass(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -17678,8 +18761,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Submodule [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Submodule.MyClass), fullyQualifiedName: "jsii-calc.submodule.MyClass", parametersJson: "[{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.submodule.child.SomeStruct\\"}}]")] public class MyClass : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.Submodule.NestedSubmodule.DeeplyNested.INamespaced { - public MyClass(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child.ISomeStruct props): base(new DeputyProps(new object?[]{props})) + public MyClass(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child.ISomeStruct props): base(_MakeDeputyProps(props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Child.ISomeStruct props) { + return new DeputyProps(new object?[]{props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -17911,10 +19000,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace.Submodule.Returnsparam [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Submodule.Returnsparam.ReturnsSpecialParameter), fullyQualifiedName: "jsii-calc.submodule.returnsparam.ReturnsSpecialParameter")] public class ReturnsSpecialParameter : DeputyBase { - public ReturnsSpecialParameter(): base(new DeputyProps(System.Array.Empty())) + public ReturnsSpecialParameter(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -17950,8 +19045,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Sum), fullyQualifiedName: "jsii-calc.Sum")] public class Sum : Amazon.JSII.Tests.CalculatorNamespace.Composition.CompositeOperation { - public Sum(): base(new DeputyProps(System.Array.Empty())) + public Sum(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18004,10 +19105,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace /// the default value of \`bar\`. /// some props once can provide. /// a variadic continuation. - public SupportsNiceJavaBuilder(double id, double? defaultBar = null, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps? props = null, params string[] rest): base(new DeputyProps(new object?[]{id, defaultBar, props, rest})) + public SupportsNiceJavaBuilder(double id, double? defaultBar = null, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps? props = null, params string[] rest): base(_MakeDeputyProps(id, defaultBar, props, rest)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double id, double? defaultBar = null, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps? props = null, params string[] rest) + { + return new DeputyProps(new object?[]{id, defaultBar, props, rest}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18088,8 +19195,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace { /// some identifier of your choice. /// some properties. - public SupportsNiceJavaBuilderWithRequiredProps(double id, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps props): base(new DeputyProps(new object?[]{id, props})) + public SupportsNiceJavaBuilderWithRequiredProps(double id, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps props): base(_MakeDeputyProps(id, props)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(double id, Amazon.JSII.Tests.CalculatorNamespace.ISupportsNiceJavaBuilderProps props) { + return new DeputyProps(new object?[]{id, props}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18140,10 +19253,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.SyncVirtualMethods), fullyQualifiedName: "jsii-calc.SyncVirtualMethods")] public class SyncVirtualMethods : DeputyBase { - public SyncVirtualMethods(): base(new DeputyProps(System.Array.Empty())) + public SyncVirtualMethods(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18273,8 +19392,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.TestStructWithEnum), fullyQualifiedName: "jsii-calc.TestStructWithEnum")] public class TestStructWithEnum : DeputyBase { - public TestStructWithEnum(): base(new DeputyProps(System.Array.Empty())) + public TestStructWithEnum(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18333,10 +19458,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Thrower), fullyQualifiedName: "jsii-calc.Thrower")] public class Thrower : DeputyBase { - public Thrower(): base(new DeputyProps(System.Array.Empty())) + public Thrower(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18381,12 +19512,28 @@ namespace Amazon.JSII.Tests.CalculatorNamespace set; } + private object _secondLevel; + /// A union to really stress test our serialization. [JsiiProperty(name: "secondLevel", typeJson: "{\\"union\\":{\\"types\\":[{\\"primitive\\":\\"number\\"},{\\"fqn\\":\\"jsii-calc.SecondLevelStruct\\"}]}}")] public object SecondLevel { - get; - set; + get => _secondLevel; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if ( + !(value is byte || value is decimal || value is double || value is float || value is int || value is long || value is sbyte || value is short || value is uint || value is ulong || value is ushort) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.ISecondLevelStruct) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: double, {typeof(Amazon.JSII.Tests.CalculatorNamespace.ISecondLevelStruct).FullName}; received {value.GetType().FullName}", $"value"); + } + } + _secondLevel = value; + } } /// You don't have to pass this. @@ -18416,10 +19563,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.TwoMethodsWithSimilarCapitalization), fullyQualifiedName: "jsii-calc.TwoMethodsWithSimilarCapitalization")] public class TwoMethodsWithSimilarCapitalization : DeputyBase { - public TwoMethodsWithSimilarCapitalization(): base(new DeputyProps(System.Array.Empty())) + public TwoMethodsWithSimilarCapitalization(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18530,10 +19683,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UnaryOperation), fullyQualifiedName: "jsii-calc.UnaryOperation", parametersJson: "[{\\"name\\":\\"operand\\",\\"type\\":{\\"fqn\\":\\"@scope/jsii-calc-lib.NumericValue\\"}}]")] public abstract class UnaryOperation : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.Operation { - protected UnaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand): base(new DeputyProps(new object?[]{operand})) + protected UnaryOperation(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand): base(_MakeDeputyProps(operand)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.NumericValue operand) + { + return new DeputyProps(new object?[]{operand}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18601,19 +19760,55 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiByValue(fqn: "jsii-calc.UnionProperties")] public class UnionProperties : Amazon.JSII.Tests.CalculatorNamespace.IUnionProperties { + private object _bar; + [JsiiProperty(name: "bar", typeJson: "{\\"union\\":{\\"types\\":[{\\"primitive\\":\\"string\\"},{\\"primitive\\":\\"number\\"},{\\"fqn\\":\\"jsii-calc.AllTypes\\"}]}}")] public object Bar { - get; - set; + get => _bar; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if ( + !(value is string) + && !(value is byte || value is decimal || value is double || value is float || value is int || value is long || value is sbyte || value is short || value is uint || value is ulong || value is ushort) + && !(value is Amazon.JSII.Tests.CalculatorNamespace.AllTypes) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: string, double, {typeof(Amazon.JSII.Tests.CalculatorNamespace.AllTypes).FullName}; received {value.GetType().FullName}", $"value"); + } + } + _bar = value; + } } + private object? _foo; + [JsiiOptional] [JsiiProperty(name: "foo", typeJson: "{\\"union\\":{\\"types\\":[{\\"primitive\\":\\"string\\"},{\\"primitive\\":\\"number\\"}]}}", isOptional: true)] public object? Foo { - get; - set; + get => _foo; + set + { + if (Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking) + { + if (value != null) + { + if ( + !(value is string) + && !(value is byte || value is decimal || value is double || value is float || value is int || value is long || value is sbyte || value is short || value is uint || value is ulong || value is ushort) + ) + + { + throw new System.ArgumentException($"Expected value to be one of: string, double; received {value.GetType().FullName}", $"value"); + } + } + } + _foo = value; + } } } } @@ -18631,10 +19826,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UpcasingReflectable), fullyQualifiedName: "jsii-calc.UpcasingReflectable", parametersJson: "[{\\"name\\":\\"delegate\\",\\"type\\":{\\"collection\\":{\\"elementtype\\":{\\"primitive\\":\\"any\\"},\\"kind\\":\\"map\\"}}}]")] public class UpcasingReflectable : DeputyBase, Amazon.JSII.Tests.CustomSubmoduleName.IReflectable { - public UpcasingReflectable(System.Collections.Generic.IDictionary @delegate): base(new DeputyProps(new object?[]{@delegate})) + public UpcasingReflectable(System.Collections.Generic.IDictionary @delegate): base(_MakeDeputyProps(@delegate)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(System.Collections.Generic.IDictionary @delegate) + { + return new DeputyProps(new object?[]{@delegate}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18676,8 +19877,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UseBundledDependency), fullyQualifiedName: "jsii-calc.UseBundledDependency")] public class UseBundledDependency : DeputyBase { - public UseBundledDependency(): base(new DeputyProps(System.Array.Empty())) + public UseBundledDependency(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18715,8 +19922,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UseCalcBase), fullyQualifiedName: "jsii-calc.UseCalcBase")] public class UseCalcBase : DeputyBase { - public UseCalcBase(): base(new DeputyProps(System.Array.Empty())) + public UseCalcBase(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18753,10 +19966,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.UsesInterfaceWithProperties), fullyQualifiedName: "jsii-calc.UsesInterfaceWithProperties", parametersJson: "[{\\"name\\":\\"obj\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.IInterfaceWithProperties\\"}}]")] public class UsesInterfaceWithProperties : DeputyBase { - public UsesInterfaceWithProperties(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithProperties obj): base(new DeputyProps(new object?[]{obj})) + public UsesInterfaceWithProperties(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithProperties obj): base(_MakeDeputyProps(obj)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.IInterfaceWithProperties obj) + { + return new DeputyProps(new object?[]{obj}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18809,10 +20028,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VariadicInvoker), fullyQualifiedName: "jsii-calc.VariadicInvoker", parametersJson: "[{\\"name\\":\\"method\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.VariadicMethod\\"}}]")] public class VariadicInvoker : DeputyBase { - public VariadicInvoker(Amazon.JSII.Tests.CalculatorNamespace.VariadicMethod method): base(new DeputyProps(new object?[]{method})) + public VariadicInvoker(Amazon.JSII.Tests.CalculatorNamespace.VariadicMethod method): base(_MakeDeputyProps(method)) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(Amazon.JSII.Tests.CalculatorNamespace.VariadicMethod method) + { + return new DeputyProps(new object?[]{method}); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -18848,8 +20073,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace public class VariadicMethod : DeputyBase { /// a prefix that will be use for all values returned by \`#asArray\`. - public VariadicMethod(params double[] prefix): base(new DeputyProps(new object?[]{prefix})) + public VariadicMethod(params double[] prefix): base(_MakeDeputyProps(prefix)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(params double[] prefix) { + return new DeputyProps(new object?[]{prefix}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18888,8 +20119,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VirtualMethodPlayground), fullyQualifiedName: "jsii-calc.VirtualMethodPlayground")] public class VirtualMethodPlayground : DeputyBase { - public VirtualMethodPlayground(): base(new DeputyProps(System.Array.Empty())) + public VirtualMethodPlayground(): base(_MakeDeputyProps()) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() { + return new DeputyProps(System.Array.Empty()); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference @@ -18958,10 +20195,16 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.VoidCallback), fullyQualifiedName: "jsii-calc.VoidCallback")] public abstract class VoidCallback : DeputyBase { - protected VoidCallback(): base(new DeputyProps(System.Array.Empty())) + protected VoidCallback(): base(_MakeDeputyProps()) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps() + { + return new DeputyProps(System.Array.Empty()); + } + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -19029,8 +20272,14 @@ namespace Amazon.JSII.Tests.CalculatorNamespace [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.WithPrivatePropertyInConstructor), fullyQualifiedName: "jsii-calc.WithPrivatePropertyInConstructor", parametersJson: "[{\\"name\\":\\"privateField\\",\\"optional\\":true,\\"type\\":{\\"primitive\\":\\"string\\"}}]")] public class WithPrivatePropertyInConstructor : DeputyBase { - public WithPrivatePropertyInConstructor(string? privateField = null): base(new DeputyProps(new object?[]{privateField})) + public WithPrivatePropertyInConstructor(string? privateField = null): base(_MakeDeputyProps(privateField)) + { + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static DeputyProps _MakeDeputyProps(string? privateField = null) { + return new DeputyProps(new object?[]{privateField}); } /// Used by jsii to construct an instance of this class from a Javascript-owned object reference diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap index 82a90bdac5..3ffd7942a5 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap @@ -5202,6 +5202,59 @@ func (j *jsiiProxy_ClassThatImplementsThePrivateInterface) SetE(val *string) { ) } +type ClassWithCollectionOfUnions interface { + UnionProperty() *[]*map[string]interface{} + SetUnionProperty(val *[]*map[string]interface{}) +} + +// The jsii proxy struct for ClassWithCollectionOfUnions +type jsiiProxy_ClassWithCollectionOfUnions struct { + _ byte // padding +} + +func (j *jsiiProxy_ClassWithCollectionOfUnions) UnionProperty() *[]*map[string]interface{} { + var returns *[]*map[string]interface{} + _jsii_.Get( + j, + "unionProperty", + &returns, + ) + return returns +} + + +func NewClassWithCollectionOfUnions(unionProperty *[]*map[string]interface{}) ClassWithCollectionOfUnions { + _init_.Initialize() + + j := jsiiProxy_ClassWithCollectionOfUnions{} + + _jsii_.Create( + "jsii-calc.ClassWithCollectionOfUnions", + []interface{}{unionProperty}, + &j, + ) + + return &j +} + +func NewClassWithCollectionOfUnions_Override(c ClassWithCollectionOfUnions, unionProperty *[]*map[string]interface{}) { + _init_.Initialize() + + _jsii_.Create( + "jsii-calc.ClassWithCollectionOfUnions", + []interface{}{unionProperty}, + c, + ) +} + +func (j *jsiiProxy_ClassWithCollectionOfUnions) SetUnionProperty(val *[]*map[string]interface{}) { + _jsii_.Set( + j, + "unionProperty", + val, + ) +} + type ClassWithCollections interface { Array() *[]*string SetArray(val *[]*string) @@ -13762,6 +13815,10 @@ func StructUnionConsumer_IsStructB(struct_ interface{}) *bool { return returns } +type StructWithCollectionOfUnionts struct { + UnionProperty *[]*map[string]interface{} \`field:"required" json:"unionProperty" yaml:"unionProperty"\` +} + type StructWithEnum struct { // An enum value. Foo StringEnum \`field:"required" json:"foo" yaml:"foo"\` @@ -15592,6 +15649,16 @@ func init() { return &j }, ) + _jsii_.RegisterClass( + "jsii-calc.ClassWithCollectionOfUnions", + reflect.TypeOf((*ClassWithCollectionOfUnions)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberProperty{JsiiProperty: "unionProperty", GoGetter: "UnionProperty"}, + }, + func() interface{} { + return &jsiiProxy_ClassWithCollectionOfUnions{} + }, + ) _jsii_.RegisterClass( "jsii-calc.ClassWithCollections", reflect.TypeOf((*ClassWithCollections)(nil)).Elem(), @@ -17334,6 +17401,10 @@ func init() { return &jsiiProxy_StructUnionConsumer{} }, ) + _jsii_.RegisterStruct( + "jsii-calc.StructWithCollectionOfUnionts", + reflect.TypeOf((*StructWithCollectionOfUnionts)(nil)).Elem(), + ) _jsii_.RegisterStruct( "jsii-calc.StructWithEnum", reflect.TypeOf((*StructWithEnum)(nil)).Elem(), diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap index 325ef0a464..705937d830 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap @@ -3605,6 +3605,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 ChildStruct982.java ┃ ┣━ 📄 ClassThatImplementsTheInternalInterface.java ┃ ┣━ 📄 ClassThatImplementsThePrivateInterface.java + ┃ ┣━ 📄 ClassWithCollectionOfUnions.java ┃ ┣━ 📄 ClassWithCollections.java ┃ ┣━ 📄 ClassWithContainerTypes.java ┃ ┣━ 📄 ClassWithDocs.java @@ -3837,6 +3838,7 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 StructParameterType.java ┃ ┣━ 📄 StructPassing.java ┃ ┣━ 📄 StructUnionConsumer.java + ┃ ┣━ 📄 StructWithCollectionOfUnionts.java ┃ ┣━ 📄 StructWithEnum.java ┃ ┣━ 📄 StructWithJavaReservedWords.java ┃ ┣━ 📁 submodule @@ -6431,6 +6433,50 @@ public class ClassThatImplementsThePrivateInterface extends software.amazon.jsii `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithCollectionOfUnions.java 1`] = ` +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ClassWithCollectionOfUnions") +public class ClassWithCollectionOfUnions extends software.amazon.jsii.JsiiObject { + + protected ClassWithCollectionOfUnions(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected ClassWithCollectionOfUnions(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param unionProperty This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public ClassWithCollectionOfUnions(final @org.jetbrains.annotations.NotNull java.util.List> unionProperty) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(unionProperty, "unionProperty is required") }); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public @org.jetbrains.annotations.NotNull java.util.List> getUnionProperty() { + return java.util.Collections.unmodifiableList(software.amazon.jsii.Kernel.get(this, "unionProperty", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class))))); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public void setUnionProperty(final @org.jetbrains.annotations.NotNull java.util.List> value) { + software.amazon.jsii.Kernel.set(this, "unionProperty", java.util.Objects.requireNonNull(value, "unionProperty is required")); + } +} + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/ClassWithCollections.java 1`] = ` package software.amazon.jsii.tests.calculator; @@ -20960,6 +21006,129 @@ public class StructUnionConsumer extends software.amazon.jsii.JsiiObject { `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/StructWithCollectionOfUnionts.java 1`] = ` +package software.amazon.jsii.tests.calculator; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.StructWithCollectionOfUnionts") +@software.amazon.jsii.Jsii.Proxy(StructWithCollectionOfUnionts.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface StructWithCollectionOfUnionts extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull java.util.List> getUnionProperty(); + + /** + * @return a {@link Builder} of {@link StructWithCollectionOfUnionts} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link StructWithCollectionOfUnionts} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static final class Builder implements software.amazon.jsii.Builder { + java.util.List> unionProperty; + + /** + * Sets the value of {@link StructWithCollectionOfUnionts#getUnionProperty} + * @param unionProperty the value to be set. This parameter is required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @SuppressWarnings("unchecked") + public Builder unionProperty(java.util.List> unionProperty) { + this.unionProperty = (java.util.List>)unionProperty; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link StructWithCollectionOfUnionts} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public StructWithCollectionOfUnionts build() { + return new Jsii$Proxy(this); + } + } + + /** + * An implementation for {@link StructWithCollectionOfUnionts} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements StructWithCollectionOfUnionts { + private final java.util.List> unionProperty; + + /** + * Constructor that initializes the object based on values retrieved from the JsiiObject. + * @param objRef Reference to the JSII managed object. + */ + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + this.unionProperty = software.amazon.jsii.Kernel.get(this, "unionProperty", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.Object.class)))); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + @SuppressWarnings("unchecked") + protected Jsii$Proxy(final Builder builder) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.unionProperty = (java.util.List>)java.util.Objects.requireNonNull(builder.unionProperty, "unionProperty is required"); + } + + @Override + public final java.util.List> getUnionProperty() { + return this.unionProperty; + } + + @Override + @software.amazon.jsii.Internal + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + + data.set("unionProperty", om.valueToTree(this.getUnionProperty())); + + final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + struct.set("fqn", om.valueToTree("jsii-calc.StructWithCollectionOfUnionts")); + struct.set("data", data); + + final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("$jsii.struct", struct); + + return obj; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + StructWithCollectionOfUnionts.Jsii$Proxy that = (StructWithCollectionOfUnionts.Jsii$Proxy) o; + + return this.unionProperty.equals(that.unionProperty); + } + + @Override + public final int hashCode() { + int result = this.unionProperty.hashCode(); + return result; + } + } +} + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/StructWithEnum.java 1`] = ` package software.amazon.jsii.tests.calculator; @@ -27176,6 +27345,7 @@ jsii-calc.CalculatorProps=software.amazon.jsii.tests.calculator.CalculatorProps jsii-calc.ChildStruct982=software.amazon.jsii.tests.calculator.ChildStruct982 jsii-calc.ClassThatImplementsTheInternalInterface=software.amazon.jsii.tests.calculator.ClassThatImplementsTheInternalInterface jsii-calc.ClassThatImplementsThePrivateInterface=software.amazon.jsii.tests.calculator.ClassThatImplementsThePrivateInterface +jsii-calc.ClassWithCollectionOfUnions=software.amazon.jsii.tests.calculator.ClassWithCollectionOfUnions jsii-calc.ClassWithCollections=software.amazon.jsii.tests.calculator.ClassWithCollections jsii-calc.ClassWithContainerTypes=software.amazon.jsii.tests.calculator.ClassWithContainerTypes jsii-calc.ClassWithDocs=software.amazon.jsii.tests.calculator.ClassWithDocs @@ -27355,6 +27525,7 @@ jsii-calc.StructB=software.amazon.jsii.tests.calculator.StructB jsii-calc.StructParameterType=software.amazon.jsii.tests.calculator.StructParameterType jsii-calc.StructPassing=software.amazon.jsii.tests.calculator.StructPassing jsii-calc.StructUnionConsumer=software.amazon.jsii.tests.calculator.StructUnionConsumer +jsii-calc.StructWithCollectionOfUnionts=software.amazon.jsii.tests.calculator.StructWithCollectionOfUnionts jsii-calc.StructWithEnum=software.amazon.jsii.tests.calculator.StructWithEnum jsii-calc.StructWithJavaReservedWords=software.amazon.jsii.tests.calculator.StructWithJavaReservedWords jsii-calc.Sum=software.amazon.jsii.tests.calculator.Sum diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap index 611dbc084c..acdd47c5b4 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap @@ -3510,6 +3510,40 @@ class CalculatorProps: ) +class ClassWithCollectionOfUnions( + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.ClassWithCollectionOfUnions", +): + def __init__( + self, + union_property: typing.Sequence[typing.Mapping[builtins.str, typing.Union[typing.Union["StructA", typing.Dict[str, typing.Any]], typing.Union["StructB", typing.Dict[str, typing.Any]]]]], + ) -> None: + ''' + :param union_property: - + ''' + if __debug__: + type_hints = typing.get_type_hints(ClassWithCollectionOfUnions.__init__) + check_type(argname="argument union_property", value=union_property, expected_type=type_hints["union_property"]) + jsii.create(self.__class__, self, [union_property]) + + @builtins.property # type: ignore[misc] + @jsii.member(jsii_name="unionProperty") + def union_property( + self, + ) -> typing.List[typing.Mapping[builtins.str, typing.Union["StructA", "StructB"]]]: + return typing.cast(typing.List[typing.Mapping[builtins.str, typing.Union["StructA", "StructB"]]], jsii.get(self, "unionProperty")) + + @union_property.setter + def union_property( + self, + value: typing.List[typing.Mapping[builtins.str, typing.Union["StructA", "StructB"]]], + ) -> None: + if __debug__: + type_hints = typing.get_type_hints(getattr(ClassWithCollectionOfUnions, "union_property").fset) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) + jsii.set(self, "unionProperty", value) + + class ClassWithCollections( metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ClassWithCollections", @@ -9828,6 +9862,47 @@ class StructUnionConsumer( return typing.cast(builtins.bool, jsii.sinvoke(cls, "isStructB", [struct])) +@jsii.data_type( + jsii_type="jsii-calc.StructWithCollectionOfUnionts", + jsii_struct_bases=[], + name_mapping={"union_property": "unionProperty"}, +) +class StructWithCollectionOfUnionts: + def __init__( + self, + *, + union_property: typing.Sequence[typing.Mapping[builtins.str, typing.Union[typing.Union[StructA, typing.Dict[str, typing.Any]], typing.Union[StructB, typing.Dict[str, typing.Any]]]]], + ) -> None: + ''' + :param union_property: + ''' + if __debug__: + type_hints = typing.get_type_hints(StructWithCollectionOfUnionts.__init__) + check_type(argname="argument union_property", value=union_property, expected_type=type_hints["union_property"]) + self._values: typing.Dict[str, typing.Any] = { + "union_property": union_property, + } + + @builtins.property + def union_property( + self, + ) -> typing.List[typing.Mapping[builtins.str, typing.Union[StructA, StructB]]]: + result = self._values.get("union_property") + assert result is not None, "Required property 'union_property' is missing" + return typing.cast(typing.List[typing.Mapping[builtins.str, typing.Union[StructA, StructB]]], result) + + def __eq__(self, rhs: typing.Any) -> builtins.bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs: typing.Any) -> builtins.bool: + return not (rhs == self) + + def __repr__(self) -> str: + return "StructWithCollectionOfUnionts(%s)" % ", ".join( + k + "=" + repr(v) for k, v in self._values.items() + ) + + @jsii.data_type( jsii_type="jsii-calc.StructWithEnum", jsii_struct_bases=[], @@ -11317,6 +11392,7 @@ __all__ = [ "ChildStruct982", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", + "ClassWithCollectionOfUnions", "ClassWithCollections", "ClassWithContainerTypes", "ClassWithDocs", @@ -11485,6 +11561,7 @@ __all__ = [ "StructParameterType", "StructPassing", "StructUnionConsumer", + "StructWithCollectionOfUnionts", "StructWithEnum", "StructWithJavaReservedWords", "Sum", diff --git a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap index fe58bea150..4befd2b964 100644 --- a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap @@ -858,6 +858,14 @@ exports[`jsii-tree --all 1`] = ` │ │ │ └── type: string │ │ └─┬ e property (stable) │ │ └── type: string + │ ├─┬ class ClassWithCollectionOfUnions (stable) + │ │ └─┬ members + │ │ ├─┬ (unionProperty) initializer (stable) + │ │ │ └─┬ parameters + │ │ │ └─┬ unionProperty + │ │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> + │ │ └─┬ unionProperty property (stable) + │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> │ ├─┬ class ClassWithCollections (stable) │ │ └─┬ members │ │ ├─┬ (map,array) initializer (stable) @@ -3134,6 +3142,12 @@ exports[`jsii-tree --all 1`] = ` │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface StructWithCollectionOfUnionts (stable) + │ │ └─┬ members + │ │ └─┬ unionProperty property (stable) + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> │ ├─┬ interface StructWithEnum (stable) │ │ └─┬ members │ │ ├─┬ foo property (stable) @@ -3641,6 +3655,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ │ └── interfaces: INonInternalInterface │ ├─┬ class ClassThatImplementsThePrivateInterface │ │ └── interfaces: INonInternalInterface + │ ├── class ClassWithCollectionOfUnions │ ├── class ClassWithCollections │ ├── class ClassWithContainerTypes │ ├── class ClassWithDocs @@ -3875,6 +3890,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├── interface StructA │ ├── interface StructB │ ├── interface StructParameterType + │ ├── interface StructWithCollectionOfUnionts │ ├── interface StructWithEnum │ ├── interface StructWithJavaReservedWords │ ├── interface SupportsNiceJavaBuilderProps @@ -4378,6 +4394,10 @@ exports[`jsii-tree --members 1`] = ` │ │ ├── b property │ │ ├── c property │ │ └── e property + │ ├─┬ class ClassWithCollectionOfUnions + │ │ └─┬ members + │ │ ├── (unionProperty) initializer + │ │ └── unionProperty property │ ├─┬ class ClassWithCollections │ │ └─┬ members │ │ ├── (map,array) initializer @@ -5343,6 +5363,9 @@ exports[`jsii-tree --members 1`] = ` │ │ └─┬ members │ │ ├── scope property │ │ └── props property + │ ├─┬ interface StructWithCollectionOfUnionts + │ │ └─┬ members + │ │ └── unionProperty property │ ├─┬ interface StructWithEnum │ │ └─┬ members │ │ ├── foo property @@ -5703,6 +5726,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── class Calculator │ ├── class ClassThatImplementsTheInternalInterface │ ├── class ClassThatImplementsThePrivateInterface + │ ├── class ClassWithCollectionOfUnions │ ├── class ClassWithCollections │ ├── class ClassWithContainerTypes │ ├── class ClassWithDocs @@ -5886,6 +5910,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── interface StructA │ ├── interface StructB │ ├── interface StructParameterType + │ ├── interface StructWithCollectionOfUnionts │ ├── interface StructWithEnum │ ├── interface StructWithJavaReservedWords │ ├── interface SupportsNiceJavaBuilderProps diff --git a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap index 298ebf3917..2f9974e3c2 100644 --- a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap @@ -1011,6 +1011,14 @@ exports[`showAll 1`] = ` │ │ │ └── type: string │ │ └─┬ e property │ │ └── type: string + │ ├─┬ class ClassWithCollectionOfUnions + │ │ └─┬ members + │ │ ├─┬ (unionProperty) initializer + │ │ │ └─┬ parameters + │ │ │ └─┬ unionProperty + │ │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> + │ │ └─┬ unionProperty property + │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> │ ├─┬ class ClassWithCollections │ │ └─┬ members │ │ ├─┬ (map,array) initializer @@ -3287,6 +3295,12 @@ exports[`showAll 1`] = ` │ │ ├── abstract │ │ ├── immutable │ │ └── type: Optional + │ ├─┬ interface StructWithCollectionOfUnionts + │ │ └─┬ members + │ │ └─┬ unionProperty property + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: Array jsii-calc.StructA | jsii-calc.StructB>> │ ├─┬ interface StructWithEnum │ │ └─┬ members │ │ ├─┬ foo property @@ -3802,6 +3816,7 @@ exports[`types 1`] = ` │ ├── class Calculator │ ├── class ClassThatImplementsTheInternalInterface │ ├── class ClassThatImplementsThePrivateInterface + │ ├── class ClassWithCollectionOfUnions │ ├── class ClassWithCollections │ ├── class ClassWithContainerTypes │ ├── class ClassWithDocs @@ -3985,6 +4000,7 @@ exports[`types 1`] = ` │ ├── interface StructA │ ├── interface StructB │ ├── interface StructParameterType + │ ├── interface StructWithCollectionOfUnionts │ ├── interface StructWithEnum │ ├── interface StructWithJavaReservedWords │ ├── interface SupportsNiceJavaBuilderProps diff --git a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap index 1519f2d4c7..59afd0f199 100644 --- a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap @@ -41,6 +41,7 @@ Array [ "jsii-calc.Calculator", "jsii-calc.ClassThatImplementsTheInternalInterface", "jsii-calc.ClassThatImplementsThePrivateInterface", + "jsii-calc.ClassWithCollectionOfUnions", "jsii-calc.ClassWithCollections", "jsii-calc.ClassWithContainerTypes", "jsii-calc.ClassWithDocs",