-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii): Correctly ignore private properties from ctor
Whend eclared as part of a constructor argument declaration, private properties would not be ignored as such, which could cause spurious JSII errors, and made private APIs visible to other languages.
- Loading branch information
1 parent
27d16c2
commit a823135
Showing
14 changed files
with
255 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ulatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/WithPrivatePropertyInConstructor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <summary>Verifies that private property declarations in constructor arguments are hidden.</summary> | ||
/// <remarks>stability: Experimental</remarks> | ||
[JsiiClass(nativeType: typeof(WithPrivatePropertyInConstructor), fullyQualifiedName: "jsii-calc.WithPrivatePropertyInConstructor", parametersJson: "[{\"name\":\"privateField\",\"type\":{\"primitive\":\"string\"},\"optional\":true}]")] | ||
public class WithPrivatePropertyInConstructor : DeputyBase | ||
{ | ||
/// <remarks>stability: Experimental</remarks> | ||
public WithPrivatePropertyInConstructor(string privateField): base(new DeputyProps(new object[]{privateField})) | ||
{ | ||
} | ||
|
||
protected WithPrivatePropertyInConstructor(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
protected WithPrivatePropertyInConstructor(DeputyProps props): base(props) | ||
{ | ||
} | ||
|
||
/// <remarks>stability: Experimental</remarks> | ||
[JsiiProperty(name: "success", typeJson: "{\"primitive\":\"boolean\"}")] | ||
public virtual bool Success | ||
{ | ||
get => GetInstanceProperty<bool>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...src/main/java/software/amazon/jsii/tests/calculator/WithPrivatePropertyInConstructor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package software.amazon.jsii.tests.calculator; | ||
|
||
/** | ||
* Verifies that private property declarations in constructor arguments are hidden. | ||
* | ||
* EXPERIMENTAL | ||
*/ | ||
@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.WithPrivatePropertyInConstructor") | ||
public class WithPrivatePropertyInConstructor extends software.amazon.jsii.JsiiObject { | ||
protected WithPrivatePropertyInConstructor(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
/** | ||
* EXPERIMENTAL | ||
*/ | ||
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) | ||
public WithPrivatePropertyInConstructor(@javax.annotation.Nullable final java.lang.String privateField) { | ||
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { privateField }); | ||
} | ||
/** | ||
* EXPERIMENTAL | ||
*/ | ||
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) | ||
public WithPrivatePropertyInConstructor() { | ||
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); | ||
} | ||
|
||
/** | ||
* EXPERIMENTAL | ||
*/ | ||
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) | ||
public java.lang.Boolean getSuccess() { | ||
return this.jsiiGet("success", java.lang.Boolean.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,5 @@ Value | |
VariadicMethod | ||
Very | ||
VirtualMethodPlayground | ||
VoidCallback | ||
VoidCallback | ||
WithPrivatePropertyInConstructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters