// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`diamond-struct-parameter.ts: / 1`] = ` ┣━ 📁 dotnet ┃ ┗━ 📁 Example.Test.Demo ┃ ┣━ 📄 AssemblyInfo.cs ┃ ┣━ 📁 Example ┃ ┃ ┗━ 📁 Test ┃ ┃ ┗━ 📁 Demo ┃ ┃ ┣━ 📄 Baz_.cs ┃ ┃ ┣━ 📄 Consumer.cs ┃ ┃ ┣━ 📄 Foo_.cs ┃ ┃ ┣━ 📄 FooBar.cs ┃ ┃ ┣━ 📄 IBaz.cs ┃ ┃ ┣━ 📄 IFoo.cs ┃ ┃ ┣━ 📄 IFooBar.cs ┃ ┃ ┗━ 📁 Internal ┃ ┃ ┗━ 📁 DependencyResolution ┃ ┃ ┗━ 📄 Anchor.cs ┃ ┗━ 📄 Example.Test.Demo.csproj ┣━ 📁 go ┃ ┗━ 📁 testpkg ┃ ┣━ 📄 Baz.go ┃ ┣━ 📄 Consumer__checks.go ┃ ┣━ 📄 Consumer__no_checks.go ┃ ┣━ 📄 Consumer.go ┃ ┣━ 📄 Foo.go ┃ ┣━ 📄 FooBar.go ┃ ┣━ 📄 go.mod ┃ ┣━ 📁 jsii ┃ ┃ ┗━ 📄 jsii.go ┃ ┗━ 📄 main.go ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src ┃ ┗━ 📁 main ┃ ┣━ 📁 java ┃ ┃ ┗━ 📁 example ┃ ┃ ┗━ 📁 test ┃ ┃ ┗━ 📁 demo ┃ ┃ ┣━ 📄 $Module.java ┃ ┃ ┣━ 📄 Baz.java ┃ ┃ ┣━ 📄 Consumer.java ┃ ┃ ┣━ 📄 Foo.java ┃ ┃ ┗━ 📄 FooBar.java ┃ ┗━ 📁 resources ┃ ┗━ 📁 example ┃ ┗━ 📁 test ┃ ┗━ 📁 demo ┃ ┗━ 📄 $Module.txt ┗━ 📁 python ┣━ 📄 pyproject.toml ┣━ 📄 setup.py ┗━ 📁 src ┗━ 📁 example_test_demo ┣━ 📄 __init__.py ┣━ 📁 _jsii ┃ ┗━ 📄 __init__.py ┗━ 📄 py.typed `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/AssemblyInfo.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; [assembly: JsiiAssembly("testpkg", "0.0.1", "testpkg-0.0.1.tgz")] `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example.Test.Demo.csproj 1`] = ` testpkg Example.Test.Demo Apache-2.0 0.0.1 John Doe en-US https://github.com/aws/jsii.git https://github.com/aws/jsii.git git true true true true enable snupkg netcoreapp3.1 Major 0612,0618 0108,0109 `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Baz_.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { #pragma warning disable CS8618 [JsiiByValue(fqn: "testpkg.Baz")] public class Baz_ : Example.Test.Demo.IBaz { [JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")] public bool Baz { get; set; } [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get; set; } [JsiiOptional] [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)] public string? Bar { get; set; } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Consumer.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiClass(nativeType: typeof(Example.Test.Demo.Consumer), fullyQualifiedName: "testpkg.Consumer")] public class Consumer : DeputyBase { /// 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 Consumer(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 Consumer(DeputyProps props): base(props) { } [JsiiMethod(name: "consumeBaz", parametersJson: "[{\\"name\\":\\"baz\\",\\"type\\":{\\"fqn\\":\\"testpkg.Baz\\"}}]")] public static void ConsumeBaz(Example.Test.Demo.IBaz baz) { InvokeStaticVoidMethod(typeof(Example.Test.Demo.Consumer), new System.Type[]{typeof(Example.Test.Demo.IBaz)}, new object[]{baz}); } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Foo_.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { #pragma warning disable CS8618 [JsiiByValue(fqn: "testpkg.Foo")] public class Foo_ : Example.Test.Demo.IFoo { [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get; set; } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/FooBar.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { #pragma warning disable CS8618 [JsiiByValue(fqn: "testpkg.FooBar")] public class FooBar : Example.Test.Demo.IFooBar { [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get; set; } [JsiiOptional] [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)] public string? Bar { get; set; } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/IBaz.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiInterface(nativeType: typeof(IBaz), fullyQualifiedName: "testpkg.Baz")] public interface IBaz : Example.Test.Demo.IFoo, Example.Test.Demo.IFooBar { [JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")] bool Baz { get; } [JsiiTypeProxy(nativeType: typeof(IBaz), fullyQualifiedName: "testpkg.Baz")] new internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IBaz { private _Proxy(ByRefValue reference): base(reference) { } [JsiiProperty(name: "baz", typeJson: "{\\"primitive\\":\\"boolean\\"}")] public bool Baz { get => GetInstanceProperty()!; } [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get => GetInstanceProperty()!; } [JsiiOptional] [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)] public string? Bar { get => GetInstanceProperty(); } } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/IFoo.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiInterface(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Foo")] public interface IFoo { [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] double Foo { get; } [JsiiTypeProxy(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Foo")] internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IFoo { private _Proxy(ByRefValue reference): base(reference) { } [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get => GetInstanceProperty()!; } } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/IFooBar.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiInterface(nativeType: typeof(IFooBar), fullyQualifiedName: "testpkg.FooBar")] public interface IFooBar { [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] double Foo { get; } [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)] [Amazon.JSII.Runtime.Deputy.JsiiOptional] string? Bar { get { return null; } } [JsiiTypeProxy(nativeType: typeof(IFooBar), fullyQualifiedName: "testpkg.FooBar")] internal sealed class _Proxy : DeputyBase, Example.Test.Demo.IFooBar { private _Proxy(ByRefValue reference): base(reference) { } [JsiiProperty(name: "foo", typeJson: "{\\"primitive\\":\\"number\\"}")] public double Foo { get => GetInstanceProperty()!; } [JsiiOptional] [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}", isOptional: true)] public string? Bar { get => GetInstanceProperty(); } } } } `; exports[`diamond-struct-parameter.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Internal/DependencyResolution/Anchor.cs 1`] = ` #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo.Internal.DependencyResolution { public sealed class Anchor { public Anchor() { } } } `; exports[`diamond-struct-parameter.ts: /go/testpkg/Baz.go 1`] = ` package testpkg type Baz struct { Foo *float64 \`field:"required" json:"foo" yaml:"foo"\` Bar *string \`field:"optional" json:"bar" yaml:"bar"\` Baz *bool \`field:"required" json:"baz" yaml:"baz"\` } `; exports[`diamond-struct-parameter.ts: /go/testpkg/Consumer.go 1`] = ` package testpkg import ( _init_ "example.test/demo/testpkg/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) type Consumer interface { } // The jsii proxy struct for Consumer type jsiiProxy_Consumer struct { _ byte // padding } func Consumer_ConsumeBaz(baz *Baz) { _init_.Initialize() if err := validateConsumer_ConsumeBazParameters(baz); err != nil { panic(err) } _jsii_.StaticInvokeVoid( "testpkg.Consumer", "consumeBaz", []interface{}{baz}, ) } `; exports[`diamond-struct-parameter.ts: /go/testpkg/Consumer__checks.go 1`] = ` //go:build !no_runtime_type_checking package testpkg import ( "fmt" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) func validateConsumer_ConsumeBazParameters(baz *Baz) error { if baz == nil { return fmt.Errorf("parameter baz is required, but nil was provided") } if err := _jsii_.ValidateStruct(baz, func() string { return "parameter baz" }); err != nil { return err } return nil } `; exports[`diamond-struct-parameter.ts: /go/testpkg/Consumer__no_checks.go 1`] = ` //go:build no_runtime_type_checking package testpkg // Building without runtime type checking enabled, so all the below just return nil func validateConsumer_ConsumeBazParameters(baz *Baz) error { return nil } `; exports[`diamond-struct-parameter.ts: /go/testpkg/Foo.go 1`] = ` package testpkg type Foo struct { Foo *float64 \`field:"required" json:"foo" yaml:"foo"\` } `; exports[`diamond-struct-parameter.ts: /go/testpkg/FooBar.go 1`] = ` package testpkg type FooBar struct { Foo *float64 \`field:"required" json:"foo" yaml:"foo"\` Bar *string \`field:"optional" json:"bar" yaml:"bar"\` } `; exports[`diamond-struct-parameter.ts: /go/testpkg/go.mod 1`] = ` module example.test/demo/testpkg go 1.18 require ( github.com/aws/jsii-runtime-go v0.0.0 ) `; exports[`diamond-struct-parameter.ts: /go/testpkg/jsii/jsii.go 1`] = ` // Package jsii contains the functionaility needed for jsii packages to // initialize their dependencies and themselves. Users should never need to use this package // directly. If you find you need to - please report a bug at // https://github.com/aws/jsii/issues/new/choose package jsii import ( _ "embed" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) //go:embed testpkg-0.0.1.tgz var tarball []byte // Initialize loads the necessary packages in the @jsii/kernel to support the enclosing module. // The implementation is idempotent (and hence safe to be called over and over). func Initialize() { // Load this library into the kernel _jsii_.Load("testpkg", "0.0.1", tarball) } `; exports[`diamond-struct-parameter.ts: /go/testpkg/main.go 1`] = ` // testpkg package testpkg import ( "reflect" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) func init() { _jsii_.RegisterStruct( "testpkg.Baz", reflect.TypeOf((*Baz)(nil)).Elem(), ) _jsii_.RegisterClass( "testpkg.Consumer", reflect.TypeOf((*Consumer)(nil)).Elem(), nil, // no members func() interface{} { return &jsiiProxy_Consumer{} }, ) _jsii_.RegisterStruct( "testpkg.Foo", reflect.TypeOf((*Foo)(nil)).Elem(), ) _jsii_.RegisterStruct( "testpkg.FooBar", reflect.TypeOf((*FooBar)(nil)).Elem(), ) } `; exports[`diamond-struct-parameter.ts: /java/pom.xml 1`] = ` 4.0.0 \${project.groupId}:\${project.artifactId} testpkg https://github.com/aws/jsii.git Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 repo An OSI-approved license John Doe author scm:git:https://github.com/aws/jsii.git https://github.com/aws/jsii.git example.test demo 0.0.1 jar UTF-8 software.amazon.jsii jsii-runtime [0.0.0-SNAPSHOT] org.jetbrains annotations [16.0.3,20.0.0) javax.annotation javax.annotation-api [1.3.2,1.4.0) compile org.apache.maven.plugins maven-compiler-plugin 3.11.0 1.8 1.8 true 4096m org.apache.maven.plugins maven-jar-plugin 3.3.0 true true true org.apache.maven.plugins maven-source-plugin 3.3.0 attach-sources jar org.apache.maven.plugins maven-javadoc-plugin 3.5.0 attach-javadocs jar false protected **/$Module.java -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 none true org.apache.maven.plugins maven-enforcer-plugin 3.3.0 enforce-maven enforce 3.6 org.codehaus.mojo versions-maven-plugin 2.16.0 false `; exports[`diamond-struct-parameter.ts: /java/src/main/java/example/test/demo/$Module.java 1`] = ` package example.test.demo; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.Reader; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import software.amazon.jsii.JsiiModule; @software.amazon.jsii.Internal public final class $Module extends JsiiModule { private static final Map MODULE_TYPES = load(); private static Map load() { final Map result = new HashMap<>(); final ClassLoader cl = $Module.class.getClassLoader(); try (final InputStream is = cl.getResourceAsStream("example/test/demo/$Module.txt"); final Reader rd = new InputStreamReader(is, StandardCharsets.UTF_8); final BufferedReader br = new BufferedReader(rd)) { br.lines() .filter(line -> !line.trim().isEmpty()) .forEach(line -> { final String[] parts = line.split("=", 2); final String fqn = parts[0]; final String className = parts[1]; result.put(fqn, className); }); } catch (final IOException exception) { throw new UncheckedIOException(exception); } return result; } private final Map> cache = new HashMap<>(); public $Module() { super("testpkg", "0.0.1", $Module.class, "testpkg@0.0.1.jsii.tgz"); } @Override protected Class resolveClass(final String fqn) throws ClassNotFoundException { if (!MODULE_TYPES.containsKey(fqn)) { throw new ClassNotFoundException("Unknown JSII type: " + fqn); } String className = MODULE_TYPES.get(fqn); if (!this.cache.containsKey(className)) { this.cache.put(className, this.findClass(className)); } return this.cache.get(className); } private Class findClass(final String binaryName) { try { return Class.forName(binaryName); } catch (final ClassNotFoundException exception) { throw new RuntimeException(exception); } } } `; exports[`diamond-struct-parameter.ts: /java/src/main/java/example/test/demo/Baz.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Baz") @software.amazon.jsii.Jsii.Proxy(Baz.Jsii$Proxy.class) public interface Baz extends software.amazon.jsii.JsiiSerializable, example.test.demo.Foo, example.test.demo.FooBar { @org.jetbrains.annotations.NotNull java.lang.Boolean getBaz(); @org.jetbrains.annotations.NotNull java.lang.Number getFoo(); /** * @return a {@link Builder} of {@link Baz} */ static Builder builder() { return new Builder(); } /** * A builder for {@link Baz} */ public static final class Builder implements software.amazon.jsii.Builder { java.lang.Boolean baz; java.lang.Number foo; java.lang.String bar; /** * Sets the value of {@link Baz#getBaz} * @param baz the value to be set. This parameter is required. * @return {@code this} */ public Builder baz(java.lang.Boolean baz) { this.baz = baz; return this; } /** * Sets the value of {@link Baz#getFoo} * @param foo the value to be set. This parameter is required. * @return {@code this} */ public Builder foo(java.lang.Number foo) { this.foo = foo; return this; } /** * Sets the value of {@link Baz#getBar} * @param bar the value to be set. * @return {@code this} */ public Builder bar(java.lang.String bar) { this.bar = bar; return this; } /** * Builds the configured instance. * @return a new instance of {@link Baz} * @throws NullPointerException if any required attribute was not provided */ @Override public Baz build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link Baz} */ @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Baz { private final java.lang.Boolean baz; private final java.lang.Number foo; private final java.lang.String bar; /** * 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.baz = software.amazon.jsii.Kernel.get(this, "baz", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); this.foo = software.amazon.jsii.Kernel.get(this, "foo", software.amazon.jsii.NativeType.forClass(java.lang.Number.class)); this.bar = software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.baz = java.util.Objects.requireNonNull(builder.baz, "baz is required"); this.foo = java.util.Objects.requireNonNull(builder.foo, "foo is required"); this.bar = builder.bar; } @Override public final java.lang.Boolean getBaz() { return this.baz; } @Override public final java.lang.Number getFoo() { return this.foo; } @Override public final java.lang.String getBar() { return this.bar; } @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("baz", om.valueToTree(this.getBaz())); data.set("foo", om.valueToTree(this.getFoo())); if (this.getBar() != null) { data.set("bar", om.valueToTree(this.getBar())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("testpkg.Baz")); 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; Baz.Jsii$Proxy that = (Baz.Jsii$Proxy) o; if (!baz.equals(that.baz)) return false; if (!foo.equals(that.foo)) return false; return this.bar != null ? this.bar.equals(that.bar) : that.bar == null; } @Override public final int hashCode() { int result = this.baz.hashCode(); result = 31 * result + (this.foo.hashCode()); result = 31 * result + (this.bar != null ? this.bar.hashCode() : 0); return result; } } } `; exports[`diamond-struct-parameter.ts: /java/src/main/java/example/test/demo/Consumer.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Consumer") public class Consumer extends software.amazon.jsii.JsiiObject { protected Consumer(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Consumer(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } public static void consumeBaz(final @org.jetbrains.annotations.NotNull example.test.demo.Baz baz) { software.amazon.jsii.JsiiObject.jsiiStaticCall(example.test.demo.Consumer.class, "consumeBaz", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(baz, "baz is required") }); } } `; exports[`diamond-struct-parameter.ts: /java/src/main/java/example/test/demo/Foo.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Foo") @software.amazon.jsii.Jsii.Proxy(Foo.Jsii$Proxy.class) public interface Foo extends software.amazon.jsii.JsiiSerializable { @org.jetbrains.annotations.NotNull java.lang.Number getFoo(); /** * @return a {@link Builder} of {@link Foo} */ static Builder builder() { return new Builder(); } /** * A builder for {@link Foo} */ public static final class Builder implements software.amazon.jsii.Builder { java.lang.Number foo; /** * Sets the value of {@link Foo#getFoo} * @param foo the value to be set. This parameter is required. * @return {@code this} */ public Builder foo(java.lang.Number foo) { this.foo = foo; return this; } /** * Builds the configured instance. * @return a new instance of {@link Foo} * @throws NullPointerException if any required attribute was not provided */ @Override public Foo build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link Foo} */ @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Foo { private final java.lang.Number foo; /** * 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.foo = software.amazon.jsii.Kernel.get(this, "foo", software.amazon.jsii.NativeType.forClass(java.lang.Number.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.foo = java.util.Objects.requireNonNull(builder.foo, "foo is required"); } @Override public final java.lang.Number getFoo() { return this.foo; } @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("foo", om.valueToTree(this.getFoo())); final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("testpkg.Foo")); 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; Foo.Jsii$Proxy that = (Foo.Jsii$Proxy) o; return this.foo.equals(that.foo); } @Override public final int hashCode() { int result = this.foo.hashCode(); return result; } } } `; exports[`diamond-struct-parameter.ts: /java/src/main/java/example/test/demo/FooBar.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.FooBar") @software.amazon.jsii.Jsii.Proxy(FooBar.Jsii$Proxy.class) public interface FooBar extends software.amazon.jsii.JsiiSerializable { @org.jetbrains.annotations.NotNull java.lang.Number getFoo(); default @org.jetbrains.annotations.Nullable java.lang.String getBar() { return null; } /** * @return a {@link Builder} of {@link FooBar} */ static Builder builder() { return new Builder(); } /** * A builder for {@link FooBar} */ public static final class Builder implements software.amazon.jsii.Builder { java.lang.Number foo; java.lang.String bar; /** * Sets the value of {@link FooBar#getFoo} * @param foo the value to be set. This parameter is required. * @return {@code this} */ public Builder foo(java.lang.Number foo) { this.foo = foo; return this; } /** * Sets the value of {@link FooBar#getBar} * @param bar the value to be set. * @return {@code this} */ public Builder bar(java.lang.String bar) { this.bar = bar; return this; } /** * Builds the configured instance. * @return a new instance of {@link FooBar} * @throws NullPointerException if any required attribute was not provided */ @Override public FooBar build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link FooBar} */ @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FooBar { private final java.lang.Number foo; private final java.lang.String bar; /** * 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.foo = software.amazon.jsii.Kernel.get(this, "foo", software.amazon.jsii.NativeType.forClass(java.lang.Number.class)); this.bar = software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.foo = java.util.Objects.requireNonNull(builder.foo, "foo is required"); this.bar = builder.bar; } @Override public final java.lang.Number getFoo() { return this.foo; } @Override public final java.lang.String getBar() { return this.bar; } @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("foo", om.valueToTree(this.getFoo())); if (this.getBar() != null) { data.set("bar", om.valueToTree(this.getBar())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("testpkg.FooBar")); 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; FooBar.Jsii$Proxy that = (FooBar.Jsii$Proxy) o; if (!foo.equals(that.foo)) return false; return this.bar != null ? this.bar.equals(that.bar) : that.bar == null; } @Override public final int hashCode() { int result = this.foo.hashCode(); result = 31 * result + (this.bar != null ? this.bar.hashCode() : 0); return result; } } } `; exports[`diamond-struct-parameter.ts: /java/src/main/resources/example/test/demo/$Module.txt 1`] = ` testpkg.Baz=example.test.demo.Baz testpkg.Consumer=example.test.demo.Consumer testpkg.Foo=example.test.demo.Foo testpkg.FooBar=example.test.demo.FooBar `; exports[`diamond-struct-parameter.ts: /python/pyproject.toml 1`] = ` [build-system] requires = ["setuptools~=67.3.2", "wheel~=0.40"] build-backend = "setuptools.build_meta" [tool.pyright] defineConstant = { DEBUG = true } pythonVersion = "3.7" pythonPlatform = "All" reportSelfClsParameterName = false `; exports[`diamond-struct-parameter.ts: /python/setup.py 1`] = ` import json import setuptools kwargs = json.loads( """ { "name": "example-test.demo", "version": "0.0.1", "description": "testpkg", "license": "Apache-2.0", "url": "https://github.com/aws/jsii.git", "long_description_content_type": "text/markdown", "author": "John Doe", "bdist_wheel": { "universal": true }, "project_urls": { "Source": "https://github.com/aws/jsii.git" }, "package_dir": { "": "src" }, "packages": [ "example_test_demo", "example_test_demo._jsii" ], "package_data": { "example_test_demo._jsii": [ "testpkg@0.0.1.jsii.tgz" ], "example_test_demo": [ "py.typed" ] }, "python_requires": "~=3.7", "install_requires": [ "jsii<0.0.1", "publication>=0.0.3", "typeguard~=2.13.3" ], "classifiers": [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: JavaScript", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Typing :: Typed", "License :: OSI Approved" ], "scripts": [] } """ ) with open("README.md", encoding="utf8") as fp: kwargs["long_description"] = fp.read() setuptools.setup(**kwargs) `; exports[`diamond-struct-parameter.ts: /python/src/example_test_demo/__init__.py 1`] = ` import abc import builtins import datetime import enum import typing import jsii import publication import typing_extensions from typeguard import check_type from ._jsii import * class Consumer(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Consumer"): @jsii.member(jsii_name="consumeBaz") @builtins.classmethod def consume_baz( cls, *, baz: builtins.bool, foo: jsii.Number, bar: typing.Optional[builtins.str] = None, ) -> None: ''' :param baz: - :param foo: - :param bar: - ''' baz_ = Baz(baz=baz, foo=foo, bar=bar) return typing.cast(None, jsii.sinvoke(cls, "consumeBaz", [baz_])) @jsii.data_type( jsii_type="testpkg.Foo", jsii_struct_bases=[], name_mapping={"foo": "foo"}, ) class Foo: def __init__(self, *, foo: jsii.Number) -> None: ''' :param foo: - ''' if __debug__: type_hints = typing.get_type_hints(_typecheckingstub__bf2f596592c027f75261089e0a96611ccca28179a004c918d9b1057b4e390db5) check_type(argname="argument foo", value=foo, expected_type=type_hints["foo"]) self._values: typing.Dict[builtins.str, typing.Any] = { "foo": foo, } @builtins.property def foo(self) -> jsii.Number: result = self._values.get("foo") assert result is not None, "Required property 'foo' is missing" return typing.cast(jsii.Number, 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 "Foo(%s)" % ", ".join( k + "=" + repr(v) for k, v in self._values.items() ) @jsii.data_type( jsii_type="testpkg.FooBar", jsii_struct_bases=[], name_mapping={"foo": "foo", "bar": "bar"}, ) class FooBar: def __init__( self, *, foo: jsii.Number, bar: typing.Optional[builtins.str] = None, ) -> None: ''' :param foo: - :param bar: - ''' if __debug__: type_hints = typing.get_type_hints(_typecheckingstub__0cb0385f4239a994a5509c1ac8d143d10f8400893975d4519442a0d7baf1b5d4) check_type(argname="argument foo", value=foo, expected_type=type_hints["foo"]) check_type(argname="argument bar", value=bar, expected_type=type_hints["bar"]) self._values: typing.Dict[builtins.str, typing.Any] = { "foo": foo, } if bar is not None: self._values["bar"] = bar @builtins.property def foo(self) -> jsii.Number: result = self._values.get("foo") assert result is not None, "Required property 'foo' is missing" return typing.cast(jsii.Number, result) @builtins.property def bar(self) -> typing.Optional[builtins.str]: result = self._values.get("bar") return typing.cast(typing.Optional[builtins.str], 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 "FooBar(%s)" % ", ".join( k + "=" + repr(v) for k, v in self._values.items() ) @jsii.data_type( jsii_type="testpkg.Baz", jsii_struct_bases=[Foo, FooBar], name_mapping={"foo": "foo", "bar": "bar", "baz": "baz"}, ) class Baz(Foo, FooBar): def __init__( self, *, foo: jsii.Number, bar: typing.Optional[builtins.str] = None, baz: builtins.bool, ) -> None: ''' :param foo: - :param bar: - :param baz: - ''' if __debug__: type_hints = typing.get_type_hints(_typecheckingstub__98e5f88ba6c94001e15cc6f3ce78d86bd3610eea1b79954536d33da0dee53b2d) check_type(argname="argument foo", value=foo, expected_type=type_hints["foo"]) check_type(argname="argument bar", value=bar, expected_type=type_hints["bar"]) check_type(argname="argument baz", value=baz, expected_type=type_hints["baz"]) self._values: typing.Dict[builtins.str, typing.Any] = { "foo": foo, "baz": baz, } if bar is not None: self._values["bar"] = bar @builtins.property def foo(self) -> jsii.Number: result = self._values.get("foo") assert result is not None, "Required property 'foo' is missing" return typing.cast(jsii.Number, result) @builtins.property def bar(self) -> typing.Optional[builtins.str]: result = self._values.get("bar") return typing.cast(typing.Optional[builtins.str], result) @builtins.property def baz(self) -> builtins.bool: result = self._values.get("baz") assert result is not None, "Required property 'baz' is missing" return typing.cast(builtins.bool, 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 "Baz(%s)" % ", ".join( k + "=" + repr(v) for k, v in self._values.items() ) __all__ = [ "Baz", "Consumer", "Foo", "FooBar", ] publication.publish() def _typecheckingstub__bf2f596592c027f75261089e0a96611ccca28179a004c918d9b1057b4e390db5( *, foo: jsii.Number, ) -> None: """Type checking stubs""" pass def _typecheckingstub__0cb0385f4239a994a5509c1ac8d143d10f8400893975d4519442a0d7baf1b5d4( *, foo: jsii.Number, bar: typing.Optional[builtins.str] = None, ) -> None: """Type checking stubs""" pass def _typecheckingstub__98e5f88ba6c94001e15cc6f3ce78d86bd3610eea1b79954536d33da0dee53b2d( *, foo: jsii.Number, bar: typing.Optional[builtins.str] = None, baz: builtins.bool, ) -> None: """Type checking stubs""" pass `; exports[`diamond-struct-parameter.ts: /python/src/example_test_demo/_jsii/__init__.py 1`] = ` import abc import builtins import datetime import enum import typing import jsii import publication import typing_extensions from typeguard import check_type __jsii_assembly__ = jsii.JSIIAssembly.load( "testpkg", "0.0.1", __name__[0:-6], "testpkg@0.0.1.jsii.tgz" ) __all__ = [ "__jsii_assembly__", ] publication.publish() `; exports[`diamond-struct-parameter.ts: /python/src/example_test_demo/py.typed 1`] = ` `; exports[`nested-types.ts: / 1`] = ` ┣━ 📁 dotnet ┃ ┗━ 📁 Example.Test.Demo ┃ ┣━ 📄 AssemblyInfo.cs ┃ ┣━ 📁 Example ┃ ┃ ┗━ 📁 Test ┃ ┃ ┗━ 📁 Demo ┃ ┃ ┣━ 📁 Internal ┃ ┃ ┃ ┗━ 📁 DependencyResolution ┃ ┃ ┃ ┗━ 📄 Anchor.cs ┃ ┃ ┣━ 📄 Namespace1.cs ┃ ┃ ┗━ 📄 Namespace2.cs ┃ ┗━ 📄 Example.Test.Demo.csproj ┣━ 📁 go ┃ ┗━ 📁 testpkg ┃ ┣━ 📄 go.mod ┃ ┣━ 📁 jsii ┃ ┃ ┗━ 📄 jsii.go ┃ ┣━ 📄 main.go ┃ ┣━ 📄 Namespace1_Foo.go ┃ ┣━ 📄 Namespace1_IBar.go ┃ ┣━ 📄 Namespace1.go ┃ ┣━ 📄 Namespace2_Foo_Final.go ┃ ┣━ 📄 Namespace2_Foo.go ┃ ┗━ 📄 Namespace2.go ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src ┃ ┗━ 📁 main ┃ ┣━ 📁 java ┃ ┃ ┗━ 📁 example ┃ ┃ ┗━ 📁 test ┃ ┃ ┗━ 📁 demo ┃ ┃ ┣━ 📄 $Module.java ┃ ┃ ┣━ 📄 Namespace1.java ┃ ┃ ┗━ 📄 Namespace2.java ┃ ┗━ 📁 resources ┃ ┗━ 📁 example ┃ ┗━ 📁 test ┃ ┗━ 📁 demo ┃ ┗━ 📄 $Module.txt ┗━ 📁 python ┣━ 📄 pyproject.toml ┣━ 📄 setup.py ┗━ 📁 src ┗━ 📁 example_test_demo ┣━ 📄 __init__.py ┣━ 📁 _jsii ┃ ┗━ 📄 __init__.py ┗━ 📄 py.typed `; exports[`nested-types.ts: /dotnet/Example.Test.Demo/AssemblyInfo.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; [assembly: JsiiAssembly("testpkg", "0.0.1", "testpkg-0.0.1.tgz")] `; exports[`nested-types.ts: /dotnet/Example.Test.Demo/Example.Test.Demo.csproj 1`] = ` testpkg Example.Test.Demo Apache-2.0 0.0.1 John Doe en-US https://github.com/aws/jsii.git https://github.com/aws/jsii.git git true true true true enable snupkg netcoreapp3.1 Major 0612,0618 0108,0109 `; exports[`nested-types.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Internal/DependencyResolution/Anchor.cs 1`] = ` #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo.Internal.DependencyResolution { public sealed class Anchor { public Anchor() { } } } `; exports[`nested-types.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Namespace1.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace1), fullyQualifiedName: "testpkg.Namespace1")] public class Namespace1 : DeputyBase { 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)] protected Namespace1(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 Namespace1(DeputyProps props): base(props) { } [JsiiMethod(name: "foo")] public virtual void Foo() { InvokeInstanceVoidMethod(new System.Type[]{}, new object[]{}); } [JsiiInterface(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Namespace1.Foo")] public interface IFoo { [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}")] string Bar { get; } [JsiiTypeProxy(nativeType: typeof(IFoo), fullyQualifiedName: "testpkg.Namespace1.Foo")] internal sealed class _Proxy : DeputyBase, Example.Test.Demo.Namespace1.IFoo { private _Proxy(ByRefValue reference): base(reference) { } [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}")] public string Bar { get => GetInstanceProperty()!; } } } #pragma warning disable CS8618 [JsiiByValue(fqn: "testpkg.Namespace1.Foo")] public class Foo : Example.Test.Demo.Namespace1.IFoo { [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}")] public string Bar { get; set; } } [JsiiInterface(nativeType: typeof(IBar), fullyQualifiedName: "testpkg.Namespace1.IBar")] public interface IBar { [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}")] string Bar { get; } [JsiiMethod(name: "method")] void Method(); [JsiiTypeProxy(nativeType: typeof(IBar), fullyQualifiedName: "testpkg.Namespace1.IBar")] internal sealed class _Proxy : DeputyBase, Example.Test.Demo.Namespace1.IBar { private _Proxy(ByRefValue reference): base(reference) { } [JsiiProperty(name: "bar", typeJson: "{\\"primitive\\":\\"string\\"}")] public string Bar { get => GetInstanceProperty()!; } [JsiiMethod(name: "method")] public void Method() { InvokeInstanceVoidMethod(new System.Type[]{}, new object[]{}); } } } } } `; exports[`nested-types.ts: /dotnet/Example.Test.Demo/Example/Test/Demo/Namespace2.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; #pragma warning disable CS0672,CS0809,CS1591 namespace Example.Test.Demo { [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace2), fullyQualifiedName: "testpkg.Namespace2")] public class Namespace2 : DeputyBase { 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)] protected Namespace2(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 Namespace2(DeputyProps props): base(props) { } [JsiiMethod(name: "foo")] public virtual void Foo() { InvokeInstanceVoidMethod(new System.Type[]{}, new object[]{}); } [JsiiEnum(nativeType: typeof(Foo), fullyQualifiedName: "testpkg.Namespace2.Foo")] public enum Foo { [JsiiEnumMember(name: "BAR")] BAR, [JsiiEnumMember(name: "BAZ")] BAZ [JsiiClass(nativeType: typeof(Example.Test.Demo.Namespace2.Foo.Final), fullyQualifiedName: "testpkg.Namespace2.Foo.Final")] public class Final : DeputyBase { 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 /// The Javascript-owned object reference [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] protected Final(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 Final(DeputyProps props): base(props) { } [JsiiProperty(name: "done", typeJson: "{\\"primitive\\":\\"boolean\\"}")] public virtual bool Done { get => GetInstanceProperty()!; } } } } } `; exports[`nested-types.ts: /go/testpkg/Namespace1.go 1`] = ` package testpkg import ( _init_ "example.test/demo/testpkg/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) type Namespace1 interface { Foo() } // The jsii proxy struct for Namespace1 type jsiiProxy_Namespace1 struct { _ byte // padding } func NewNamespace1() Namespace1 { _init_.Initialize() j := jsiiProxy_Namespace1{} _jsii_.Create( "testpkg.Namespace1", nil, // no parameters &j, ) return &j } func NewNamespace1_Override(n Namespace1) { _init_.Initialize() _jsii_.Create( "testpkg.Namespace1", nil, // no parameters n, ) } func (n *jsiiProxy_Namespace1) Foo() { _jsii_.InvokeVoid( n, "foo", nil, // no parameters ) } `; exports[`nested-types.ts: /go/testpkg/Namespace1_Foo.go 1`] = ` package testpkg type Namespace1_Foo struct { Bar *string \`field:"required" json:"bar" yaml:"bar"\` } `; exports[`nested-types.ts: /go/testpkg/Namespace1_IBar.go 1`] = ` package testpkg import ( _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) type Namespace1_IBar interface { Method() Bar() *string } // The jsii proxy for Namespace1_IBar type jsiiProxy_Namespace1_IBar struct { _ byte // padding } func (n *jsiiProxy_Namespace1_IBar) Method() { _jsii_.InvokeVoid( n, "method", nil, // no parameters ) } func (j *jsiiProxy_Namespace1_IBar) Bar() *string { var returns *string _jsii_.Get( j, "bar", &returns, ) return returns } `; exports[`nested-types.ts: /go/testpkg/Namespace2.go 1`] = ` package testpkg import ( _init_ "example.test/demo/testpkg/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) type Namespace2 interface { Foo() } // The jsii proxy struct for Namespace2 type jsiiProxy_Namespace2 struct { _ byte // padding } func NewNamespace2() Namespace2 { _init_.Initialize() j := jsiiProxy_Namespace2{} _jsii_.Create( "testpkg.Namespace2", nil, // no parameters &j, ) return &j } func NewNamespace2_Override(n Namespace2) { _init_.Initialize() _jsii_.Create( "testpkg.Namespace2", nil, // no parameters n, ) } func (n *jsiiProxy_Namespace2) Foo() { _jsii_.InvokeVoid( n, "foo", nil, // no parameters ) } `; exports[`nested-types.ts: /go/testpkg/Namespace2_Foo.go 1`] = ` package testpkg type Namespace2_Foo string const ( Namespace2_Foo_BAR Namespace2_Foo = "BAR" Namespace2_Foo_BAZ Namespace2_Foo = "BAZ" ) `; exports[`nested-types.ts: /go/testpkg/Namespace2_Foo_Final.go 1`] = ` package testpkg import ( _init_ "example.test/demo/testpkg/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) type Namespace2_Foo_Final interface { Done() *bool } // The jsii proxy struct for Namespace2_Foo_Final type jsiiProxy_Namespace2_Foo_Final struct { _ byte // padding } func (j *jsiiProxy_Namespace2_Foo_Final) Done() *bool { var returns *bool _jsii_.Get( j, "done", &returns, ) return returns } func NewNamespace2_Foo_Final() Namespace2_Foo_Final { _init_.Initialize() j := jsiiProxy_Namespace2_Foo_Final{} _jsii_.Create( "testpkg.Namespace2.Foo.Final", nil, // no parameters &j, ) return &j } func NewNamespace2_Foo_Final_Override(n Namespace2_Foo_Final) { _init_.Initialize() _jsii_.Create( "testpkg.Namespace2.Foo.Final", nil, // no parameters n, ) } `; exports[`nested-types.ts: /go/testpkg/go.mod 1`] = ` module example.test/demo/testpkg go 1.18 require ( github.com/aws/jsii-runtime-go v0.0.0 ) `; exports[`nested-types.ts: /go/testpkg/jsii/jsii.go 1`] = ` // Package jsii contains the functionaility needed for jsii packages to // initialize their dependencies and themselves. Users should never need to use this package // directly. If you find you need to - please report a bug at // https://github.com/aws/jsii/issues/new/choose package jsii import ( _ "embed" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) //go:embed testpkg-0.0.1.tgz var tarball []byte // Initialize loads the necessary packages in the @jsii/kernel to support the enclosing module. // The implementation is idempotent (and hence safe to be called over and over). func Initialize() { // Load this library into the kernel _jsii_.Load("testpkg", "0.0.1", tarball) } `; exports[`nested-types.ts: /go/testpkg/main.go 1`] = ` // testpkg package testpkg import ( "reflect" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) func init() { _jsii_.RegisterClass( "testpkg.Namespace1", reflect.TypeOf((*Namespace1)(nil)).Elem(), []_jsii_.Member{ _jsii_.MemberMethod{JsiiMethod: "foo", GoMethod: "Foo"}, }, func() interface{} { return &jsiiProxy_Namespace1{} }, ) _jsii_.RegisterStruct( "testpkg.Namespace1.Foo", reflect.TypeOf((*Namespace1_Foo)(nil)).Elem(), ) _jsii_.RegisterInterface( "testpkg.Namespace1.IBar", reflect.TypeOf((*Namespace1_IBar)(nil)).Elem(), []_jsii_.Member{ _jsii_.MemberProperty{JsiiProperty: "bar", GoGetter: "Bar"}, _jsii_.MemberMethod{JsiiMethod: "method", GoMethod: "Method"}, }, func() interface{} { return &jsiiProxy_Namespace1_IBar{} }, ) _jsii_.RegisterClass( "testpkg.Namespace2", reflect.TypeOf((*Namespace2)(nil)).Elem(), []_jsii_.Member{ _jsii_.MemberMethod{JsiiMethod: "foo", GoMethod: "Foo"}, }, func() interface{} { return &jsiiProxy_Namespace2{} }, ) _jsii_.RegisterEnum( "testpkg.Namespace2.Foo", reflect.TypeOf((*Namespace2_Foo)(nil)).Elem(), map[string]interface{}{ "BAR": Namespace2_Foo_BAR, "BAZ": Namespace2_Foo_BAZ, }, ) _jsii_.RegisterClass( "testpkg.Namespace2.Foo.Final", reflect.TypeOf((*Namespace2_Foo_Final)(nil)).Elem(), []_jsii_.Member{ _jsii_.MemberProperty{JsiiProperty: "done", GoGetter: "Done"}, }, func() interface{} { return &jsiiProxy_Namespace2_Foo_Final{} }, ) } `; exports[`nested-types.ts: /java/pom.xml 1`] = ` 4.0.0 \${project.groupId}:\${project.artifactId} testpkg https://github.com/aws/jsii.git Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 repo An OSI-approved license John Doe author scm:git:https://github.com/aws/jsii.git https://github.com/aws/jsii.git example.test demo 0.0.1 jar UTF-8 software.amazon.jsii jsii-runtime [0.0.0-SNAPSHOT] org.jetbrains annotations [16.0.3,20.0.0) javax.annotation javax.annotation-api [1.3.2,1.4.0) compile org.apache.maven.plugins maven-compiler-plugin 3.11.0 1.8 1.8 true 4096m org.apache.maven.plugins maven-jar-plugin 3.3.0 true true true org.apache.maven.plugins maven-source-plugin 3.3.0 attach-sources jar org.apache.maven.plugins maven-javadoc-plugin 3.5.0 attach-javadocs jar false protected **/$Module.java -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 none true org.apache.maven.plugins maven-enforcer-plugin 3.3.0 enforce-maven enforce 3.6 org.codehaus.mojo versions-maven-plugin 2.16.0 false `; exports[`nested-types.ts: /java/src/main/java/example/test/demo/$Module.java 1`] = ` package example.test.demo; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.Reader; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import software.amazon.jsii.JsiiModule; @software.amazon.jsii.Internal public final class $Module extends JsiiModule { private static final Map MODULE_TYPES = load(); private static Map load() { final Map result = new HashMap<>(); final ClassLoader cl = $Module.class.getClassLoader(); try (final InputStream is = cl.getResourceAsStream("example/test/demo/$Module.txt"); final Reader rd = new InputStreamReader(is, StandardCharsets.UTF_8); final BufferedReader br = new BufferedReader(rd)) { br.lines() .filter(line -> !line.trim().isEmpty()) .forEach(line -> { final String[] parts = line.split("=", 2); final String fqn = parts[0]; final String className = parts[1]; result.put(fqn, className); }); } catch (final IOException exception) { throw new UncheckedIOException(exception); } return result; } private final Map> cache = new HashMap<>(); public $Module() { super("testpkg", "0.0.1", $Module.class, "testpkg@0.0.1.jsii.tgz"); } @Override protected Class resolveClass(final String fqn) throws ClassNotFoundException { if (!MODULE_TYPES.containsKey(fqn)) { throw new ClassNotFoundException("Unknown JSII type: " + fqn); } String className = MODULE_TYPES.get(fqn); if (!this.cache.containsKey(className)) { this.cache.put(className, this.findClass(className)); } return this.cache.get(className); } private Class findClass(final String binaryName) { try { return Class.forName(binaryName); } catch (final ClassNotFoundException exception) { throw new RuntimeException(exception); } } } `; exports[`nested-types.ts: /java/src/main/java/example/test/demo/Namespace1.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace1") public class Namespace1 extends software.amazon.jsii.JsiiObject { protected Namespace1(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Namespace1(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } public Namespace1() { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } public void foo() { software.amazon.jsii.Kernel.call(this, "foo", software.amazon.jsii.NativeType.VOID); } @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace1.Foo") @software.amazon.jsii.Jsii.Proxy(Foo.Jsii$Proxy.class) public static interface Foo extends software.amazon.jsii.JsiiSerializable { @org.jetbrains.annotations.NotNull java.lang.String getBar(); /** * @return a {@link Builder} of {@link Foo} */ static Builder builder() { return new Builder(); } /** * A builder for {@link Foo} */ public static final class Builder implements software.amazon.jsii.Builder { java.lang.String bar; /** * Sets the value of {@link Foo#getBar} * @param bar the value to be set. This parameter is required. * @return {@code this} */ public Builder bar(java.lang.String bar) { this.bar = bar; return this; } /** * Builds the configured instance. * @return a new instance of {@link Foo} * @throws NullPointerException if any required attribute was not provided */ @Override public Foo build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link Foo} */ @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Foo { private final java.lang.String bar; /** * 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.bar = software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.bar = java.util.Objects.requireNonNull(builder.bar, "bar is required"); } @Override public final java.lang.String getBar() { return this.bar; } @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("bar", om.valueToTree(this.getBar())); final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("testpkg.Namespace1.Foo")); 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; Foo.Jsii$Proxy that = (Foo.Jsii$Proxy) o; return this.bar.equals(that.bar); } @Override public final int hashCode() { int result = this.bar.hashCode(); return result; } } } @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace1.IBar") @software.amazon.jsii.Jsii.Proxy(IBar.Jsii$Proxy.class) public static interface IBar extends software.amazon.jsii.JsiiSerializable { @org.jetbrains.annotations.NotNull java.lang.String getBar(); void method(); /** * A proxy class which represents a concrete javascript instance of this type. */ @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements example.test.demo.Namespace1.IBar.Jsii$Default { protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } @Override public final @org.jetbrains.annotations.NotNull java.lang.String getBar() { return software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } @Override public final void method() { software.amazon.jsii.Kernel.call(this, "method", software.amazon.jsii.NativeType.VOID); } } /** * Internal default implementation for {@link IBar}. */ @software.amazon.jsii.Internal interface Jsii$Default extends IBar { @Override default @org.jetbrains.annotations.NotNull java.lang.String getBar() { return software.amazon.jsii.Kernel.get(this, "bar", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } @Override default void method() { software.amazon.jsii.Kernel.call(this, "method", software.amazon.jsii.NativeType.VOID); } } } } `; exports[`nested-types.ts: /java/src/main/java/example/test/demo/Namespace2.java 1`] = ` package example.test.demo; @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace2") public class Namespace2 extends software.amazon.jsii.JsiiObject { protected Namespace2(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Namespace2(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } public Namespace2() { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } public void foo() { software.amazon.jsii.Kernel.call(this, "foo", software.amazon.jsii.NativeType.VOID); } @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace2.Foo") public enum Foo { BAR, BAZ, @software.amazon.jsii.Jsii(module = example.test.demo.$Module.class, fqn = "testpkg.Namespace2.Foo.Final") public static class Final extends software.amazon.jsii.JsiiObject { protected Final(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Final(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } public Final() { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); } public @org.jetbrains.annotations.NotNull java.lang.Boolean getDone() { return software.amazon.jsii.Kernel.get(this, "done", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); } } } } `; exports[`nested-types.ts: /java/src/main/resources/example/test/demo/$Module.txt 1`] = ` testpkg.Namespace1=example.test.demo.Namespace1 testpkg.Namespace1.Foo=example.test.demo.Namespace1$Foo testpkg.Namespace1.IBar=example.test.demo.Namespace1$IBar testpkg.Namespace2=example.test.demo.Namespace2 testpkg.Namespace2.Foo=example.test.demo.Namespace2$Foo testpkg.Namespace2.Foo.Final=example.test.demo.Namespace2$Foo.Final `; exports[`nested-types.ts: /python/pyproject.toml 1`] = ` [build-system] requires = ["setuptools~=67.3.2", "wheel~=0.40"] build-backend = "setuptools.build_meta" [tool.pyright] defineConstant = { DEBUG = true } pythonVersion = "3.7" pythonPlatform = "All" reportSelfClsParameterName = false `; exports[`nested-types.ts: /python/setup.py 1`] = ` import json import setuptools kwargs = json.loads( """ { "name": "example-test.demo", "version": "0.0.1", "description": "testpkg", "license": "Apache-2.0", "url": "https://github.com/aws/jsii.git", "long_description_content_type": "text/markdown", "author": "John Doe", "bdist_wheel": { "universal": true }, "project_urls": { "Source": "https://github.com/aws/jsii.git" }, "package_dir": { "": "src" }, "packages": [ "example_test_demo", "example_test_demo._jsii" ], "package_data": { "example_test_demo._jsii": [ "testpkg@0.0.1.jsii.tgz" ], "example_test_demo": [ "py.typed" ] }, "python_requires": "~=3.7", "install_requires": [ "jsii<0.0.1", "publication>=0.0.3", "typeguard~=2.13.3" ], "classifiers": [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: JavaScript", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Typing :: Typed", "License :: OSI Approved" ], "scripts": [] } """ ) with open("README.md", encoding="utf8") as fp: kwargs["long_description"] = fp.read() setuptools.setup(**kwargs) `; exports[`nested-types.ts: /python/src/example_test_demo/__init__.py 1`] = ` import abc import builtins import datetime import enum import typing import jsii import publication import typing_extensions from typeguard import check_type from ._jsii import * class Namespace1(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace1"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @jsii.member(jsii_name="foo") def foo(self) -> None: return typing.cast(None, jsii.invoke(self, "foo", [])) @jsii.data_type( jsii_type="testpkg.Namespace1.Foo", jsii_struct_bases=[], name_mapping={"bar": "bar"}, ) class Foo: def __init__(self, *, bar: builtins.str) -> None: ''' :param bar: - ''' if __debug__: type_hints = typing.get_type_hints(_typecheckingstub__2a8df629360a764124e23427f4b4bb1422fef01e5b6dcd040a2f64d477f476d9) check_type(argname="argument bar", value=bar, expected_type=type_hints["bar"]) self._values: typing.Dict[builtins.str, typing.Any] = { "bar": bar, } @builtins.property def bar(self) -> builtins.str: result = self._values.get("bar") assert result is not None, "Required property 'bar' is missing" return typing.cast(builtins.str, 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 "Foo(%s)" % ", ".join( k + "=" + repr(v) for k, v in self._values.items() ) @jsii.interface(jsii_type="testpkg.Namespace1.IBar") class IBar(typing_extensions.Protocol): @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> builtins.str: ... @jsii.member(jsii_name="method") def method(self) -> None: ... class _IBarProxy: __jsii_type__: typing.ClassVar[str] = "testpkg.Namespace1.IBar" @builtins.property @jsii.member(jsii_name="bar") def bar(self) -> builtins.str: return typing.cast(builtins.str, jsii.get(self, "bar")) @jsii.member(jsii_name="method") def method(self) -> None: return typing.cast(None, jsii.invoke(self, "method", [])) # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface typing.cast(typing.Any, IBar).__jsii_proxy_class__ = lambda : _IBarProxy class Namespace2(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace2"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @jsii.member(jsii_name="foo") def foo(self) -> None: return typing.cast(None, jsii.invoke(self, "foo", [])) @jsii.enum(jsii_type="testpkg.Namespace2.Foo") class Foo(enum.Enum): BAR = "BAR" BAZ = "BAZ" class Final(metaclass=jsii.JSIIMeta, jsii_type="testpkg.Namespace2.Foo.Final"): def __init__(self) -> None: jsii.create(self.__class__, self, []) @builtins.property @jsii.member(jsii_name="done") def done(self) -> builtins.bool: return typing.cast(builtins.bool, jsii.get(self, "done")) __all__ = [ "Namespace1", "Namespace2", ] publication.publish() def _typecheckingstub__2a8df629360a764124e23427f4b4bb1422fef01e5b6dcd040a2f64d477f476d9( *, bar: builtins.str, ) -> None: """Type checking stubs""" pass `; exports[`nested-types.ts: /python/src/example_test_demo/_jsii/__init__.py 1`] = ` import abc import builtins import datetime import enum import typing import jsii import publication import typing_extensions from typeguard import check_type __jsii_assembly__ = jsii.JSIIAssembly.load( "testpkg", "0.0.1", __name__[0:-6], "testpkg@0.0.1.jsii.tgz" ) __all__ = [ "__jsii_assembly__", ] publication.publish() `; exports[`nested-types.ts: /python/src/example_test_demo/py.typed 1`] = ` `;