diff --git a/packages/jsii-calc/lib/compliance.ts b/packages/jsii-calc/lib/compliance.ts index 6eebdd085a..dbc64eeadb 100644 --- a/packages/jsii-calc/lib/compliance.ts +++ b/packages/jsii-calc/lib/compliance.ts @@ -2332,10 +2332,10 @@ export class JsonFormatter { return () => 'boom'; } - public static anyDate(): any { + public static anyDate(): any { return new Date('2019-11-18T13:01:20.515Z'); } - + public static anyNumber(): any { return 123; } @@ -2374,3 +2374,25 @@ export class JsonFormatter { private constructor() { } } + +/** + * This tries to confuse Jackson by having overloaded property setters. + * + * @see https://github.com/aws/aws-cdk/issues/4080 + */ +export class ConfusingToJackson { + public static makeInstance(): ConfusingToJackson { + return new ConfusingToJackson(); + } + + public static makeStructInstance(): ConfusingToJacksonStruct { + return {}; + } + + public unionProperty?: Array | IFriendly; + + private constructor() { } +} +export interface ConfusingToJacksonStruct { + readonly unionProperty?: Array | IFriendly; +} diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 26fb504812..7c25daaba1 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -2221,6 +2221,149 @@ } ] }, + "jsii-calc.ConfusingToJackson": { + "assembly": "jsii-calc", + "docs": { + "see": "https://github.com/aws/aws-cdk/issues/4080", + "stability": "experimental", + "summary": "This tries to confuse Jackson by having overloaded property setters." + }, + "fqn": "jsii-calc.ConfusingToJackson", + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2383 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2384 + }, + "name": "makeInstance", + "returns": { + "type": { + "fqn": "jsii-calc.ConfusingToJackson" + } + }, + "static": true + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2388 + }, + "name": "makeStructInstance", + "returns": { + "type": { + "fqn": "jsii-calc.ConfusingToJacksonStruct" + } + }, + "static": true + } + ], + "name": "ConfusingToJackson", + "properties": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2392 + }, + "name": "unionProperty", + "optional": true, + "type": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "fqn": "jsii-calc.AbstractClass" + } + ] + } + }, + "kind": "array" + } + } + ] + } + } + } + ] + }, + "jsii-calc.ConfusingToJacksonStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ConfusingToJacksonStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2396 + }, + "name": "ConfusingToJacksonStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2397 + }, + "name": "unionProperty", + "optional": true, + "type": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "fqn": "jsii-calc.AbstractClass" + } + ] + } + }, + "kind": "array" + } + } + ] + } + } + } + ] + }, "jsii-calc.ConstructorPassesThisOut": { "assembly": "jsii-calc", "docs": { @@ -11525,5 +11668,5 @@ } }, "version": "0.20.8", - "fingerprint": "N6rN2lItGrVvvguYWKJffMgN+NaFLr5GQp2a1fmrbx0=" + "fingerprint": "s++IK3929zHRbg2MXmnn2A+PdvZnMVvPwaarJuUeBNM=" } diff --git a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs index 277f703800..3940262b5d 100644 --- a/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs +++ b/packages/jsii-dotnet-runtime-test/test/Amazon.JSII.Runtime.IntegrationTests/ComplianceTests.cs @@ -1034,7 +1034,7 @@ public void VariadicCallbacksAreHandledCorrectly() } [Fact(DisplayName = Prefix + nameof(ReturnSubclassThatImplementsInterface976))] - public void ReturnSubclassThatImplementsInterface976() + public void ReturnSubclassThatImplementsInterface976() { var obj = SomeTypeJsii976.ReturnReturn(); Assert.Equal(333, obj.Foo); @@ -1291,12 +1291,24 @@ public void StructsAreUndecoratedOntheWayToKernel() { var json = JsonFormatter.Stringify(new StructB {RequiredString = "Bazinga!", OptionalBoolean = false}); var actual = JObject.Parse(json); - + var expected = new JObject(); expected.Add("RequiredString", "Bazinga!"); expected.Add("OptionalBoolean", false); Assert.Equal(expected, actual); } + + [Fact(DisplayName = Prefix + nameof(CanObtainReferenceWithOverloadedSetters))] + public void CanObtainReferenceWithOverloadedSetters() + { + Assert.NotNull(ConfusingToJackson.MakeInstance()); + } + + [Fact(DisplayName = Prefix + nameof(CanObtainStructReferenceWithOverloadedSetters))] + public void CanObtainStructReferenceWithOverloadedSetters() + { + Assert.NotNull(ConfusingToJackson.MakeStructInstance()); + } } } diff --git a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java index 5c2de51f30..b60eb262d5 100644 --- a/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java +++ b/packages/jsii-java-runtime-test/project/src/test/java/software/amazon/jsii/testing/ComplianceTest.java @@ -1584,4 +1584,14 @@ public void structsAreUndecoratedOntheWayToKernel() throws IOException { assertEquals(expected, actual); } + + @Test + public void canObtainReferenceWithOverloadedSetter() { + assertNotNull(ConfusingToJackson.makeInstance()); + } + + @Test + public void canObtainStructReferenceWithOverloadedSetter() { + assertNotNull(ConfusingToJackson.makeStructInstance()); + } } diff --git a/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectMapper.java b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectMapper.java index 2eecded39b..76e6327dce 100644 --- a/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectMapper.java +++ b/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectMapper.java @@ -50,7 +50,14 @@ public static T treeToValue(final JsonNode tree, final Class valueType) { return null; } try { - final T result = INSTANCE.treeToValue(tree, valueType); + // If the needed type is a sub-class of JsiiObject, we'll be receiving it by-reference, so we can ask Jackson to + // de-serialize a JsiiObject instead of the actual type; and we'll still get the correct instance type. This + // avoids running into problems because of Jackson not liking the structure of a particular class (it will + // validate that before attempting any deserialization operation, and I don't know how to mute this behavior). + final Class deserType = JsiiObject.class.isAssignableFrom(valueType) + ? JsiiObject.class + : valueType; + final Object result = INSTANCE.treeToValue(tree, deserType); if (result != null && valueType.isInterface() && result instanceof JsiiObject) { // The result type does not implement the interface, returning the proxy instead! if (!valueType.isAssignableFrom(result.getClass()) && valueType.isAnnotationPresent(Jsii.Proxy.class)) { @@ -58,7 +65,7 @@ public static T treeToValue(final JsonNode tree, final Class valueType) { return (T)((JsiiObject) result).asInterfaceProxy(proxyAnnotation.value()); } } - return result; + return (T)result; } catch (final JsonProcessingException jpe) { throw new JsiiException(jpe); } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 26fb504812..7c25daaba1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -2221,6 +2221,149 @@ } ] }, + "jsii-calc.ConfusingToJackson": { + "assembly": "jsii-calc", + "docs": { + "see": "https://github.com/aws/aws-cdk/issues/4080", + "stability": "experimental", + "summary": "This tries to confuse Jackson by having overloaded property setters." + }, + "fqn": "jsii-calc.ConfusingToJackson", + "kind": "class", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2383 + }, + "methods": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2384 + }, + "name": "makeInstance", + "returns": { + "type": { + "fqn": "jsii-calc.ConfusingToJackson" + } + }, + "static": true + }, + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2388 + }, + "name": "makeStructInstance", + "returns": { + "type": { + "fqn": "jsii-calc.ConfusingToJacksonStruct" + } + }, + "static": true + } + ], + "name": "ConfusingToJackson", + "properties": [ + { + "docs": { + "stability": "experimental" + }, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2392 + }, + "name": "unionProperty", + "optional": true, + "type": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "fqn": "jsii-calc.AbstractClass" + } + ] + } + }, + "kind": "array" + } + } + ] + } + } + } + ] + }, + "jsii-calc.ConfusingToJacksonStruct": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "experimental" + }, + "fqn": "jsii-calc.ConfusingToJacksonStruct", + "kind": "interface", + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2396 + }, + "name": "ConfusingToJacksonStruct", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "experimental" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/compliance.ts", + "line": 2397 + }, + "name": "unionProperty", + "optional": true, + "type": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "collection": { + "elementtype": { + "union": { + "types": [ + { + "fqn": "@scope/jsii-calc-lib.IFriendly" + }, + { + "fqn": "jsii-calc.AbstractClass" + } + ] + } + }, + "kind": "array" + } + } + ] + } + } + } + ] + }, "jsii-calc.ConstructorPassesThisOut": { "assembly": "jsii-calc", "docs": { @@ -11525,5 +11668,5 @@ } }, "version": "0.20.8", - "fingerprint": "N6rN2lItGrVvvguYWKJffMgN+NaFLr5GQp2a1fmrbx0=" + "fingerprint": "s++IK3929zHRbg2MXmnn2A+PdvZnMVvPwaarJuUeBNM=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJackson.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJackson.cs new file mode 100644 index 0000000000..00f30521f8 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJackson.cs @@ -0,0 +1,51 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// This tries to confuse Jackson by having overloaded property setters. + /// + /// stability: Experimental + /// see: + /// https://github.com/aws/aws-cdk/issues/4080 + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.ConfusingToJackson), fullyQualifiedName: "jsii-calc.ConfusingToJackson")] + public class ConfusingToJackson : DeputyBase + { + protected ConfusingToJackson(ByRefValue reference): base(reference) + { + } + + protected ConfusingToJackson(DeputyProps props): base(props) + { + } + + /// + /// stability: Experimental + /// + [JsiiMethod(name: "makeInstance", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.ConfusingToJackson\"}}")] + public static Amazon.JSII.Tests.CalculatorNamespace.ConfusingToJackson MakeInstance() + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.ConfusingToJackson), new System.Type[]{}, new object[]{}); + } + + /// + /// stability: Experimental + /// + [JsiiMethod(name: "makeStructInstance", returnsJson: "{\"type\":{\"fqn\":\"jsii-calc.ConfusingToJacksonStruct\"}}")] + public static Amazon.JSII.Tests.CalculatorNamespace.IConfusingToJacksonStruct MakeStructInstance() + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.ConfusingToJackson), new System.Type[]{}, new object[]{}); + } + + /// + /// stability: Experimental + /// + [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 virtual object UnionProperty + { + get => GetInstanceProperty(); + set => SetInstanceProperty(value); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStruct.cs new file mode 100644 index 0000000000..0f3969cf05 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStruct.cs @@ -0,0 +1,22 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// + /// stability: Experimental + /// + [JsiiByValue(fqn: "jsii-calc.ConfusingToJacksonStruct")] + public class ConfusingToJacksonStruct : Amazon.JSII.Tests.CalculatorNamespace.IConfusingToJacksonStruct + { + /// + /// stability: Experimental + /// + [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, isOverride: true)] + public object UnionProperty + { + get; + set; + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStructProxy.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStructProxy.cs new file mode 100644 index 0000000000..9ad6d0fa9b --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/ConfusingToJacksonStructProxy.cs @@ -0,0 +1,25 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// + /// stability: Experimental + /// + [JsiiTypeProxy(nativeType: typeof(IConfusingToJacksonStruct), fullyQualifiedName: "jsii-calc.ConfusingToJacksonStruct")] + internal sealed class ConfusingToJacksonStructProxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.IConfusingToJacksonStruct + { + private ConfusingToJacksonStructProxy(ByRefValue reference): base(reference) + { + } + + /// + /// stability: Experimental + /// + [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 => GetInstanceProperty(); + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IConfusingToJacksonStruct.cs b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IConfusingToJacksonStruct.cs new file mode 100644 index 0000000000..58e1e3f732 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IConfusingToJacksonStruct.cs @@ -0,0 +1,24 @@ +using Amazon.JSII.Runtime.Deputy; + +namespace Amazon.JSII.Tests.CalculatorNamespace +{ + /// + /// stability: Experimental + /// + [JsiiInterface(nativeType: typeof(IConfusingToJacksonStruct), fullyQualifiedName: "jsii-calc.ConfusingToJacksonStruct")] + public interface IConfusingToJacksonStruct + { + /// + /// stability: Experimental + /// + [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)] + [Amazon.JSII.Runtime.Deputy.JsiiOptional] + object UnionProperty + { + get + { + return null; + } + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java index 1a8f2c5a03..e93d22d3ab 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/$Module.java @@ -41,6 +41,8 @@ protected Class resolveClass(final String fqn) throws ClassNotFoundException case "jsii-calc.ClassWithJavaReservedWords": return software.amazon.jsii.tests.calculator.ClassWithJavaReservedWords.class; case "jsii-calc.ClassWithMutableObjectLiteralProperty": return software.amazon.jsii.tests.calculator.ClassWithMutableObjectLiteralProperty.class; case "jsii-calc.ClassWithPrivateConstructorAndAutomaticProperties": return software.amazon.jsii.tests.calculator.ClassWithPrivateConstructorAndAutomaticProperties.class; + case "jsii-calc.ConfusingToJackson": return software.amazon.jsii.tests.calculator.ConfusingToJackson.class; + case "jsii-calc.ConfusingToJacksonStruct": return software.amazon.jsii.tests.calculator.ConfusingToJacksonStruct.class; case "jsii-calc.ConstructorPassesThisOut": return software.amazon.jsii.tests.calculator.ConstructorPassesThisOut.class; case "jsii-calc.Constructors": return software.amazon.jsii.tests.calculator.Constructors.class; case "jsii-calc.ConsumerCanRingBell": return software.amazon.jsii.tests.calculator.ConsumerCanRingBell.class; diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJackson.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJackson.java new file mode 100644 index 0000000000..9b3c465529 --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJackson.java @@ -0,0 +1,62 @@ +package software.amazon.jsii.tests.calculator; + +/** + * This tries to confuse Jackson by having overloaded property setters. + * + * EXPERIMENTAL + * + * @see https://github.com/aws/aws-cdk/issues/4080 + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ConfusingToJackson") +public class ConfusingToJackson extends software.amazon.jsii.JsiiObject { + + protected ConfusingToJackson(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected ConfusingToJackson(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public static software.amazon.jsii.tests.calculator.ConfusingToJackson makeInstance() { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.ConfusingToJackson.class, "makeInstance", software.amazon.jsii.tests.calculator.ConfusingToJackson.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public static software.amazon.jsii.tests.calculator.ConfusingToJacksonStruct makeStructInstance() { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.ConfusingToJackson.class, "makeStructInstance", software.amazon.jsii.tests.calculator.ConfusingToJacksonStruct.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public java.lang.Object getUnionProperty() { + return this.jsiiGet("unionProperty", java.lang.Object.class); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public void setUnionProperty(final software.amazon.jsii.tests.calculator.lib.IFriendly value) { + this.jsiiSet("unionProperty", value); + } + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public void setUnionProperty(final java.util.List value) { + this.jsiiSet("unionProperty", value); + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJacksonStruct.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJacksonStruct.java new file mode 100644 index 0000000000..b54afd948d --- /dev/null +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/ConfusingToJacksonStruct.java @@ -0,0 +1,131 @@ +package software.amazon.jsii.tests.calculator; + +/** + * EXPERIMENTAL + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.ConfusingToJacksonStruct") +@software.amazon.jsii.Jsii.Proxy(ConfusingToJacksonStruct.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) +public interface ConfusingToJacksonStruct extends software.amazon.jsii.JsiiSerializable { + + /** + * EXPERIMENTAL + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + default java.lang.Object getUnionProperty() { + return null; + } + + /** + * @return a {@link Builder} of {@link ConfusingToJacksonStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link ConfusingToJacksonStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public static final class Builder { + private java.lang.Object unionProperty; + + /** + * Sets the value of UnionProperty + * @param unionProperty the value to be set. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder unionProperty(software.amazon.jsii.tests.calculator.lib.IFriendly unionProperty) { + this.unionProperty = unionProperty; + return this; + } + + /** + * Sets the value of UnionProperty + * @param unionProperty the value to be set. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public Builder unionProperty(java.util.List unionProperty) { + this.unionProperty = unionProperty; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link ConfusingToJacksonStruct} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + public ConfusingToJacksonStruct build() { + return new Jsii$Proxy(unionProperty); + } + } + + /** + * An implementation for {@link ConfusingToJacksonStruct} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ConfusingToJacksonStruct { + private final java.lang.Object 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 = this.jsiiGet("unionProperty", java.lang.Object.class); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + private Jsii$Proxy(final java.lang.Object unionProperty) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.unionProperty = unionProperty; + } + + @Override + public java.lang.Object getUnionProperty() { + return this.unionProperty; + } + + @Override + 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(); + + if (this.getUnionProperty() != null) { + 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.ConfusingToJacksonStruct")); + 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 boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ConfusingToJacksonStruct.Jsii$Proxy that = (ConfusingToJacksonStruct.Jsii$Proxy) o; + + return this.unionProperty != null ? this.unionProperty.equals(that.unionProperty) : that.unionProperty == null; + } + + @Override + public int hashCode() { + int result = this.unionProperty != null ? this.unionProperty.hashCode() : 0; + return result; + } + } +} diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py index ab5df3da03..b032c51eec 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/src/jsii_calc/__init__.py @@ -862,6 +862,77 @@ def mutable_object(self, value: "IMutableObjectLiteral"): return jsii.set(self, "mutableObject", value) +class ConfusingToJackson(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ConfusingToJackson"): + """This tries to confuse Jackson by having overloaded property setters. + + see + :see: https://github.com/aws/aws-cdk/issues/4080 + stability + :stability: experimental + """ + @jsii.member(jsii_name="makeInstance") + @classmethod + def make_instance(cls) -> "ConfusingToJackson": + """ + stability + :stability: experimental + """ + return jsii.sinvoke(cls, "makeInstance", []) + + @jsii.member(jsii_name="makeStructInstance") + @classmethod + def make_struct_instance(cls) -> "ConfusingToJacksonStruct": + """ + stability + :stability: experimental + """ + return jsii.sinvoke(cls, "makeStructInstance", []) + + @property + @jsii.member(jsii_name="unionProperty") + def union_property(self) -> typing.Optional[typing.Union[typing.Optional[scope.jsii_calc_lib.IFriendly], typing.Optional[typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]]]: + """ + stability + :stability: experimental + """ + return jsii.get(self, "unionProperty") + + @union_property.setter + def union_property(self, value: typing.Optional[typing.Union[typing.Optional[scope.jsii_calc_lib.IFriendly], typing.Optional[typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]]]): + return jsii.set(self, "unionProperty", value) + + +@jsii.data_type(jsii_type="jsii-calc.ConfusingToJacksonStruct", jsii_struct_bases=[], name_mapping={'union_property': 'unionProperty'}) +class ConfusingToJacksonStruct(): + def __init__(self, *, union_property: typing.Optional[typing.Union[typing.Optional[scope.jsii_calc_lib.IFriendly], typing.Optional[typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]]]=None): + """ + :param union_property: + + stability + :stability: experimental + """ + self._values = { + } + if union_property is not None: self._values["union_property"] = union_property + + @property + def union_property(self) -> typing.Optional[typing.Union[typing.Optional[scope.jsii_calc_lib.IFriendly], typing.Optional[typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]]]: + """ + stability + :stability: experimental + """ + return self._values.get('union_property') + + def __eq__(self, rhs) -> bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs) -> bool: + return not (rhs == self) + + def __repr__(self) -> str: + return 'ConfusingToJacksonStruct(%s)' % ', '.join(k + '=' + repr(v) for k, v in self._values.items()) + + class ConstructorPassesThisOut(metaclass=jsii.JSIIMeta, jsii_type="jsii-calc.ConstructorPassesThisOut"): """ stability @@ -8111,6 +8182,6 @@ def parts(self, value: typing.List[scope.jsii_calc_lib.Value]): return jsii.set(self, "parts", value) -__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AnonymousImplementationProvider", "AsyncVirtualMethods", "AugmentableClass", "BaseJsii976", "Bell", "BinaryOperation", "Calculator", "CalculatorProps", "ChildStruct982", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithCollections", "ClassWithDocs", "ClassWithJavaReservedWords", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConstructorPassesThisOut", "Constructors", "ConsumerCanRingBell", "ConsumersOfThisCrazyTypeSystem", "DataRenderer", "DefaultedConstructorArgument", "Demonstrate982", "DeprecatedClass", "DeprecatedEnum", "DeprecatedStruct", "DerivedClassHasNoProperties", "DerivedStruct", "DiamondInheritanceBaseLevelStruct", "DiamondInheritanceFirstMidLevelStruct", "DiamondInheritanceSecondMidLevelStruct", "DiamondInheritanceTopLevelStruct", "DisappointingCollectionSource", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EnumDispenser", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExperimentalClass", "ExperimentalEnum", "ExperimentalStruct", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnonymousImplementationProvider", "IAnonymouslyImplementMe", "IAnotherPublicInterface", "IBell", "IBellRinger", "IConcreteBellRinger", "IDeprecatedInterface", "IExperimentalInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IObjectWithProperty", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnJsii976", "IReturnsNumber", "IStableInterface", "ImplementInternalInterface", "Implementation", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "InterfacesMaker", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "JsonFormatter", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NestedStruct", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "ObjectWithPropertyProvider", "Old", "OptionalArgumentInvoker", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverridableProtectedMember", "OverrideReturnsObject", "ParentStruct982", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RootStruct", "RootStructValidator", "RuntimeTypeChecking", "SecondLevelStruct", "SingleInstanceTwoTypes", "SingletonInt", "SingletonIntEnum", "SingletonString", "SingletonStringEnum", "SomeTypeJsii976", "StableClass", "StableEnum", "StableStruct", "StaticContext", "Statics", "StringEnum", "StripInternal", "StructA", "StructB", "StructPassing", "StructUnionConsumer", "StructWithJavaReservedWords", "Sum", "SupportsNiceJavaBuilder", "SupportsNiceJavaBuilderProps", "SupportsNiceJavaBuilderWithRequiredProps", "SyncVirtualMethods", "Thrower", "TopLevelStruct", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicInvoker", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "WithPrivatePropertyInConstructor", "__jsii_assembly__", "composition"] +__all__ = ["AbstractClass", "AbstractClassBase", "AbstractClassReturner", "Add", "AllTypes", "AllTypesEnum", "AllowedMethodNames", "AnonymousImplementationProvider", "AsyncVirtualMethods", "AugmentableClass", "BaseJsii976", "Bell", "BinaryOperation", "Calculator", "CalculatorProps", "ChildStruct982", "ClassThatImplementsTheInternalInterface", "ClassThatImplementsThePrivateInterface", "ClassWithCollections", "ClassWithDocs", "ClassWithJavaReservedWords", "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "ConfusingToJackson", "ConfusingToJacksonStruct", "ConstructorPassesThisOut", "Constructors", "ConsumerCanRingBell", "ConsumersOfThisCrazyTypeSystem", "DataRenderer", "DefaultedConstructorArgument", "Demonstrate982", "DeprecatedClass", "DeprecatedEnum", "DeprecatedStruct", "DerivedClassHasNoProperties", "DerivedStruct", "DiamondInheritanceBaseLevelStruct", "DiamondInheritanceFirstMidLevelStruct", "DiamondInheritanceSecondMidLevelStruct", "DiamondInheritanceTopLevelStruct", "DisappointingCollectionSource", "DoNotOverridePrivates", "DoNotRecognizeAnyAsOptional", "DocumentedClass", "DontComplainAboutVariadicAfterOptional", "DoubleTrouble", "EnumDispenser", "EraseUndefinedHashValues", "EraseUndefinedHashValuesOptions", "ExperimentalClass", "ExperimentalEnum", "ExperimentalStruct", "ExportedBaseClass", "ExtendsInternalInterface", "GiveMeStructs", "Greetee", "GreetingAugmenter", "IAnonymousImplementationProvider", "IAnonymouslyImplementMe", "IAnotherPublicInterface", "IBell", "IBellRinger", "IConcreteBellRinger", "IDeprecatedInterface", "IExperimentalInterface", "IExtendsPrivateInterface", "IFriendlier", "IFriendlyRandomGenerator", "IInterfaceImplementedByAbstractClass", "IInterfaceThatShouldNotBeADataType", "IInterfaceWithInternal", "IInterfaceWithMethods", "IInterfaceWithOptionalMethodArguments", "IInterfaceWithProperties", "IInterfaceWithPropertiesExtension", "IJSII417Derived", "IJSII417PublicBaseOfBase", "IJsii487External", "IJsii487External2", "IJsii496", "IMutableObjectLiteral", "INonInternalInterface", "IObjectWithProperty", "IPrivatelyImplemented", "IPublicInterface", "IPublicInterface2", "IRandomNumberGenerator", "IReturnJsii976", "IReturnsNumber", "IStableInterface", "ImplementInternalInterface", "Implementation", "ImplementsInterfaceWithInternal", "ImplementsInterfaceWithInternalSubclass", "ImplementsPrivateInterface", "ImplictBaseOfBase", "InbetweenClass", "InterfaceInNamespaceIncludesClasses", "InterfaceInNamespaceOnlyInterface", "InterfacesMaker", "JSII417Derived", "JSII417PublicBaseOfBase", "JSObjectLiteralForInterface", "JSObjectLiteralToNative", "JSObjectLiteralToNativeClass", "JavaReservedWords", "Jsii487Derived", "Jsii496Derived", "JsiiAgent", "JsonFormatter", "LoadBalancedFargateServiceProps", "Multiply", "Negate", "NestedStruct", "NodeStandardLibrary", "NullShouldBeTreatedAsUndefined", "NullShouldBeTreatedAsUndefinedData", "NumberGenerator", "ObjectRefsInCollections", "ObjectWithPropertyProvider", "Old", "OptionalArgumentInvoker", "OptionalConstructorArgument", "OptionalStruct", "OptionalStructConsumer", "OverridableProtectedMember", "OverrideReturnsObject", "ParentStruct982", "PartiallyInitializedThisConsumer", "Polymorphism", "Power", "PublicClass", "PythonReservedWords", "ReferenceEnumFromScopedPackage", "ReturnsPrivateImplementationOfInterface", "RootStruct", "RootStructValidator", "RuntimeTypeChecking", "SecondLevelStruct", "SingleInstanceTwoTypes", "SingletonInt", "SingletonIntEnum", "SingletonString", "SingletonStringEnum", "SomeTypeJsii976", "StableClass", "StableEnum", "StableStruct", "StaticContext", "Statics", "StringEnum", "StripInternal", "StructA", "StructB", "StructPassing", "StructUnionConsumer", "StructWithJavaReservedWords", "Sum", "SupportsNiceJavaBuilder", "SupportsNiceJavaBuilderProps", "SupportsNiceJavaBuilderWithRequiredProps", "SyncVirtualMethods", "Thrower", "TopLevelStruct", "UnaryOperation", "UnionProperties", "UseBundledDependency", "UseCalcBase", "UsesInterfaceWithProperties", "VariadicInvoker", "VariadicMethod", "VirtualMethodPlayground", "VoidCallback", "WithPrivatePropertyInConstructor", "__jsii_assembly__", "composition"] publication.publish() diff --git a/packages/jsii-python-runtime/tests/test_compliance.py b/packages/jsii-python-runtime/tests/test_compliance.py index e6dfde2288..1d6070c97f 100644 --- a/packages/jsii-python-runtime/tests/test_compliance.py +++ b/packages/jsii-python-runtime/tests/test_compliance.py @@ -16,6 +16,7 @@ AsyncVirtualMethods, Calculator, ClassWithPrivateConstructorAndAutomaticProperties, + ConfusingToJackson, ConsumerCanRingBell, ConstructorPassesThisOut, DataRenderer, @@ -1073,3 +1074,9 @@ def test_can_use_interface_setters(): def test_structs_are_undecorated_on_the_way_to_kernel(): json = JsonFormatter.stringify(StructB(required_string='Bazinga!', optional_boolean=False)) assert loads(json) == {'requiredString': 'Bazinga!', 'optionalBoolean': False} + +def test_can_obtain_reference_with_overloaded_setter(): + assert ConfusingToJackson.make_instance() is not None + +def test_can_obtain_struct_reference_with_overloaded_setter(): + assert ConfusingToJackson.make_struct_instance() is not None 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 5cd87ed4ec..e61f71443e 100644 --- a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap @@ -329,6 +329,16 @@ exports[`jsii-tree --all 1`] = ` │ │ │ └── type: string │ │ └─┬ readWriteString property (experimental) │ │ └── type: string + │ ├─┬ class ConfusingToJackson (experimental) + │ │ └─┬ members + │ │ ├─┬ static makeInstance() method (experimental) + │ │ │ ├── static + │ │ │ └── returns: jsii-calc.ConfusingToJackson + │ │ ├─┬ static makeStructInstance() method (experimental) + │ │ │ ├── static + │ │ │ └── returns: jsii-calc.ConfusingToJacksonStruct + │ │ └─┬ unionProperty property (experimental) + │ │ └── type: Optional<@scope/jsii-calc-lib.IFriendly | Array<@scope/jsii-calc-lib.IFriendly | jsii-calc.AbstractClass>> │ ├─┬ class ConstructorPassesThisOut (experimental) │ │ └─┬ members │ │ └─┬ (consumer) initializer (experimental) @@ -1629,6 +1639,12 @@ exports[`jsii-tree --all 1`] = ` │ │ ├── abstract │ │ ├── immutable │ │ └── type: number + │ ├─┬ interface ConfusingToJacksonStruct (experimental) + │ │ └─┬ members + │ │ └─┬ unionProperty property (experimental) + │ │ ├── abstract + │ │ ├── immutable + │ │ └── type: Optional<@scope/jsii-calc-lib.IFriendly | Array<@scope/jsii-calc-lib.IFriendly | jsii-calc.AbstractClass>> │ ├─┬ interface DeprecatedStruct (deprecated) │ │ └─┬ members │ │ └─┬ readonlyProperty property (deprecated) @@ -2323,6 +2339,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├── class ClassWithMutableObjectLiteralProperty │ ├─┬ class ClassWithPrivateConstructorAndAutomaticProperties │ │ └── interfaces: IInterfaceWithProperties + │ ├── class ConfusingToJackson │ ├── class ConstructorPassesThisOut │ ├── class Constructors │ ├── class ConsumerCanRingBell @@ -2432,6 +2449,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├─┬ interface ChildStruct982 │ │ └─┬ interfaces │ │ └── ParentStruct982 + │ ├── interface ConfusingToJacksonStruct │ ├── interface DeprecatedStruct │ ├─┬ interface DerivedStruct │ │ └─┬ interfaces @@ -2702,6 +2720,11 @@ exports[`jsii-tree --members 1`] = ` │ │ ├── static create(readOnlyString,readWriteString) method │ │ ├── readOnlyString property │ │ └── readWriteString property + │ ├─┬ class ConfusingToJackson + │ │ └─┬ members + │ │ ├── static makeInstance() method + │ │ ├── static makeStructInstance() method + │ │ └── unionProperty property │ ├─┬ class ConstructorPassesThisOut │ │ └─┬ members │ │ └── (consumer) initializer @@ -3257,6 +3280,9 @@ exports[`jsii-tree --members 1`] = ` │ ├─┬ interface ChildStruct982 │ │ └─┬ members │ │ └── bar property + │ ├─┬ interface ConfusingToJacksonStruct + │ │ └─┬ members + │ │ └── unionProperty property │ ├─┬ interface DeprecatedStruct │ │ └─┬ members │ │ └── readonlyProperty property @@ -3595,6 +3621,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── class ClassWithJavaReservedWords │ ├── class ClassWithMutableObjectLiteralProperty │ ├── class ClassWithPrivateConstructorAndAutomaticProperties + │ ├── class ConfusingToJackson │ ├── class ConstructorPassesThisOut │ ├── class Constructors │ ├── class ConsumerCanRingBell @@ -3684,6 +3711,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── class CompositeOperation │ ├── interface CalculatorProps │ ├── interface ChildStruct982 + │ ├── interface ConfusingToJacksonStruct │ ├── interface DeprecatedStruct │ ├── interface DerivedStruct │ ├── interface DiamondInheritanceBaseLevelStruct 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 2a1a69bcfb..4bd5eb80e2 100644 --- a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap @@ -34,6 +34,7 @@ Array [ "ClassWithMutableObjectLiteralProperty", "ClassWithPrivateConstructorAndAutomaticProperties", "CompositeOperation", + "ConfusingToJackson", "ConstructorPassesThisOut", "Constructors", "ConsumerCanRingBell",