-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(rosetta) Java codegen issues #2984
Comments
Interesting. This is exactly the comment I made on the cdklabs/jsii-docgen#435 (comment) Could rosetta be suffering from the same bug? |
Probably! |
Here's another Java issue:
|
I made the call about |
Enum and public static const accesses are turned into getters, which they shouldn't be. Related #2984.
Enum and public static const accesses are turned into getters, which they shouldn't be. Related #2984. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
* Builders were never used for structs, even though that's required. * The integrated class+struct builder wasn't always used for class translations, even if it was available. Rectify both of these issues. Relates to #2984.
Fixes two issues: ## Builders were never used for structs It's required to use builders to instantiate structs -- the code we generated would generate: ```java new MyStruct().setter(1).setter(2) ``` But the actual required syntax is ```java MyStruct.builder().setter(1).setter(2).build(); ``` This was caused because there's a confusion: the structs jsii generates have a builder. *However*, we also support declaring classes and structs *inline* in the example, and to not muck up the example too much we don't generate builders for those. Since it's probably desirable to show the definition of some constructs (like stacks) and some props types in examples, we can't get rid of that capability. So instead, check if the struct/class we're referencing actually comes from jsii or not, and use a builder if it does. ## Classes never use the combined class+struct builder Classes with a struct argument can be instantiated in two ways: ```java new MyClass(1, 2, MyStruct.builder() .setter(1) .setter(2)) .build()); ``` As well as: ``` MyClass.Builder.create(1, 2) .setter(1) .setter(2) .build(); ``` Prefer the second style as it's less noisy. Relates to #2984. This PR also switches off the `consistent-return` eslint warning, as it hurts more than helps when we have TypeScript available. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
@rix0rrr Can this be closed? |
Not yet, but I'll get on it |
|
All issues have been resolved |
…k/test/generated-code (#4296) Bumps [pip](https://github.com/pypa/pip) from 23.2.1 to 23.3. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p> <blockquote> <h1>23.3 (2023-10-15)</h1> <h2>Process</h2> <ul> <li>Added reference to <code>vulnerability reporting guidelines <https://www.python.org/dev/security/></code>_ to pip's security policy.</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop a fallback to using SecureTransport on macOS. It was useful when pip detected OpenSSL older than 1.0.1, but the current pip does not support any Python version supporting such old OpenSSL versions. (<code>[#12175](pypa/pip#12175) <https://github.com/pypa/pip/issues/12175></code>_)</li> </ul> <h2>Features</h2> <ul> <li>Improve extras resolution for multiple constraints on same base package. (<code>[#11924](pypa/pip#11924) <https://github.com/pypa/pip/issues/11924></code>_)</li> <li>Improve use of datastructures to make candidate selection 1.6x faster. (<code>[#12204](pypa/pip#12204) <https://github.com/pypa/pip/issues/12204></code>_)</li> <li>Allow <code>pip install --dry-run</code> to use platform and ABI overriding options. (<code>[#12215](pypa/pip#12215) <https://github.com/pypa/pip/issues/12215></code>_)</li> <li>Add <code>is_yanked</code> boolean entry to the installation report (<code>--report</code>) to indicate whether the requirement was yanked from the index, but was still selected by pip conform to :pep:<code>592</code>. (<code>[#12224](pypa/pip#12224) <https://github.com/pypa/pip/issues/12224></code>_)</li> </ul> <h2>Bug Fixes</h2> <ul> <li>Ignore errors in temporary directory cleanup (show a warning instead). (<code>[#11394](pypa/pip#11394) <https://github.com/pypa/pip/issues/11394></code>_)</li> <li>Normalize extras according to :pep:<code>685</code> from package metadata in the resolver for comparison. This ensures extras are correctly compared and merged as long as the package providing the extra(s) is built with values normalized according to the standard. Note, however, that this <em>does not</em> solve cases where the package itself contains unnormalized extra values in the metadata. (<code>[#11649](pypa/pip#11649) <https://github.com/pypa/pip/issues/11649></code>_)</li> <li>Prevent downloading sdists twice when :pep:<code>658</code> metadata is present. (<code>[#11847](pypa/pip#11847) <https://github.com/pypa/pip/issues/11847></code>_)</li> <li>Include all requested extras in the install report (<code>--report</code>). (<code>[#11924](pypa/pip#11924) <https://github.com/pypa/pip/issues/11924></code>_)</li> <li>Removed uses of <code>datetime.datetime.utcnow</code> from non-vendored code. (<code>[#12005](pypa/pip#12005) <https://github.com/pypa/pip/issues/12005></code>_)</li> <li>Consistently report whether a dependency comes from an extra. (<code>[#12095](pypa/pip#12095) <https://github.com/pypa/pip/issues/12095></code>_)</li> <li>Fix completion script for zsh (<code>[#12166](pypa/pip#12166) <https://github.com/pypa/pip/issues/12166></code>_)</li> <li>Fix improper handling of the new onexc argument of <code>shutil.rmtree()</code> in Python 3.12. (<code>[#12187](pypa/pip#12187) <https://github.com/pypa/pip/issues/12187></code>_)</li> <li>Filter out yanked links from the available versions error message: "(from versions: 1.0, 2.0, 3.0)" will not contain yanked versions conform PEP 592. The yanked versions (if any) will be mentioned in a separate error message. (<code>[#12225](pypa/pip#12225) <https://github.com/pypa/pip/issues/12225></code>_)</li> <li>Fix crash when the git version number contains something else than digits and dots. (<code>[#12280](pypa/pip#12280) <https://github.com/pypa/pip/issues/12280></code>_)</li> <li>Use <code>-r=...</code> instead of <code>-r ...</code> to specify references with Mercurial. (<code>[#12306](pypa/pip#12306) <https://github.com/pypa/pip/issues/12306></code>_)</li> <li>Redact password from URLs in some additional places. (<code>[#12350](pypa/pip#12350) <https://github.com/pypa/pip/issues/12350></code>_)</li> <li>pip uses less memory when caching large packages. As a result, there is a new on-disk cache format stored in a new directory ($PIP_CACHE_DIR/http-v2). (<code>[#2984](pypa/pip#2984) <https://github.com/pypa/pip/issues/2984></code>_)</li> </ul> <h2>Vendored Libraries</h2> <ul> <li>Upgrade certifi to 2023.7.22</li> <li>Add truststore 0.8.0</li> <li>Upgrade urllib3 to 1.26.17</li> </ul> <p>Improved Documentation</p> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pypa/pip/commit/e3dc91dad93a020b3034a87ebe59027f63370fe8"><code>e3dc91d</code></a> Bump for release</li> <li><a href="https://github.com/pypa/pip/commit/3e85558b10722598fb3353126e2f19979f7cf7dd"><code>3e85558</code></a> Update AUTHORS.txt</li> <li><a href="https://github.com/pypa/pip/commit/8d0278771c7325b04f02cb073c8ef02827cbeb93"><code>8d02787</code></a> Reclassify news fragment</li> <li><a href="https://github.com/pypa/pip/commit/f6ecf406c3929b3127ddb480ef4350542d102338"><code>f6ecf40</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12350">#12350</a> from sbidoul/readact-collecting-url</li> <li><a href="https://github.com/pypa/pip/commit/306086513bd1a6500126057492ee8b0f9a2e79dd"><code>3060865</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12335">#12335</a> from edmorley/patch-1</li> <li><a href="https://github.com/pypa/pip/commit/8f0ed32413daa411a728b50cd7776b9c02b010d5"><code>8f0ed32</code></a> Redact URLs in Collecting... logs</li> <li><a href="https://github.com/pypa/pip/commit/d1659b87e46abd0a2dcc74f2160dd52e6190e13b"><code>d1659b8</code></a> Correct issue number for NEWS entry added by <a href="https://redirect.github.com/pypa/pip/issues/12197">#12197</a></li> <li><a href="https://github.com/pypa/pip/commit/2333ef3b53a71fb7acc9e76d6ff90409576b2250"><code>2333ef3</code></a> Upgrade urllib3 to 1.26.17 (<a href="https://redirect.github.com/pypa/pip/issues/12343">#12343</a>)</li> <li><a href="https://github.com/pypa/pip/commit/496b268c1b9ce3466c08eb4819e5460a943d1793"><code>496b268</code></a> Update "Running Tests" documentation (<a href="https://redirect.github.com/pypa/pip/issues/12334">#12334</a>)</li> <li><a href="https://github.com/pypa/pip/commit/d1f0981cb2af3c72ff871b54a8a98581ccb2890a"><code>d1f0981</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12331">#12331</a> from sbidoul/update-egg-deprecation-message</li> <li>Additional commits viewable in <a href="https://github.com/pypa/pip/compare/23.2.1...23.3">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=23.2.1&new-version=23.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
…s/@jsii/python-runtime (#4295) Updates the requirements on [pip](https://github.com/pypa/pip) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p> <blockquote> <h1>23.3 (2023-10-15)</h1> <h2>Process</h2> <ul> <li>Added reference to <code>vulnerability reporting guidelines <https://www.python.org/dev/security/></code>_ to pip's security policy.</li> </ul> <h2>Deprecations and Removals</h2> <ul> <li>Drop a fallback to using SecureTransport on macOS. It was useful when pip detected OpenSSL older than 1.0.1, but the current pip does not support any Python version supporting such old OpenSSL versions. (<code>[#12175](pypa/pip#12175) <https://github.com/pypa/pip/issues/12175></code>_)</li> </ul> <h2>Features</h2> <ul> <li>Improve extras resolution for multiple constraints on same base package. (<code>[#11924](pypa/pip#11924) <https://github.com/pypa/pip/issues/11924></code>_)</li> <li>Improve use of datastructures to make candidate selection 1.6x faster. (<code>[#12204](pypa/pip#12204) <https://github.com/pypa/pip/issues/12204></code>_)</li> <li>Allow <code>pip install --dry-run</code> to use platform and ABI overriding options. (<code>[#12215](pypa/pip#12215) <https://github.com/pypa/pip/issues/12215></code>_)</li> <li>Add <code>is_yanked</code> boolean entry to the installation report (<code>--report</code>) to indicate whether the requirement was yanked from the index, but was still selected by pip conform to :pep:<code>592</code>. (<code>[#12224](pypa/pip#12224) <https://github.com/pypa/pip/issues/12224></code>_)</li> </ul> <h2>Bug Fixes</h2> <ul> <li>Ignore errors in temporary directory cleanup (show a warning instead). (<code>[#11394](pypa/pip#11394) <https://github.com/pypa/pip/issues/11394></code>_)</li> <li>Normalize extras according to :pep:<code>685</code> from package metadata in the resolver for comparison. This ensures extras are correctly compared and merged as long as the package providing the extra(s) is built with values normalized according to the standard. Note, however, that this <em>does not</em> solve cases where the package itself contains unnormalized extra values in the metadata. (<code>[#11649](pypa/pip#11649) <https://github.com/pypa/pip/issues/11649></code>_)</li> <li>Prevent downloading sdists twice when :pep:<code>658</code> metadata is present. (<code>[#11847](pypa/pip#11847) <https://github.com/pypa/pip/issues/11847></code>_)</li> <li>Include all requested extras in the install report (<code>--report</code>). (<code>[#11924](pypa/pip#11924) <https://github.com/pypa/pip/issues/11924></code>_)</li> <li>Removed uses of <code>datetime.datetime.utcnow</code> from non-vendored code. (<code>[#12005](pypa/pip#12005) <https://github.com/pypa/pip/issues/12005></code>_)</li> <li>Consistently report whether a dependency comes from an extra. (<code>[#12095](pypa/pip#12095) <https://github.com/pypa/pip/issues/12095></code>_)</li> <li>Fix completion script for zsh (<code>[#12166](pypa/pip#12166) <https://github.com/pypa/pip/issues/12166></code>_)</li> <li>Fix improper handling of the new onexc argument of <code>shutil.rmtree()</code> in Python 3.12. (<code>[#12187](pypa/pip#12187) <https://github.com/pypa/pip/issues/12187></code>_)</li> <li>Filter out yanked links from the available versions error message: "(from versions: 1.0, 2.0, 3.0)" will not contain yanked versions conform PEP 592. The yanked versions (if any) will be mentioned in a separate error message. (<code>[#12225](pypa/pip#12225) <https://github.com/pypa/pip/issues/12225></code>_)</li> <li>Fix crash when the git version number contains something else than digits and dots. (<code>[#12280](pypa/pip#12280) <https://github.com/pypa/pip/issues/12280></code>_)</li> <li>Use <code>-r=...</code> instead of <code>-r ...</code> to specify references with Mercurial. (<code>[#12306](pypa/pip#12306) <https://github.com/pypa/pip/issues/12306></code>_)</li> <li>Redact password from URLs in some additional places. (<code>[#12350](pypa/pip#12350) <https://github.com/pypa/pip/issues/12350></code>_)</li> <li>pip uses less memory when caching large packages. As a result, there is a new on-disk cache format stored in a new directory ($PIP_CACHE_DIR/http-v2). (<code>[#2984](pypa/pip#2984) <https://github.com/pypa/pip/issues/2984></code>_)</li> </ul> <h2>Vendored Libraries</h2> <ul> <li>Upgrade certifi to 2023.7.22</li> <li>Add truststore 0.8.0</li> <li>Upgrade urllib3 to 1.26.17</li> </ul> <p>Improved Documentation</p> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pypa/pip/commit/e3dc91dad93a020b3034a87ebe59027f63370fe8"><code>e3dc91d</code></a> Bump for release</li> <li><a href="https://github.com/pypa/pip/commit/3e85558b10722598fb3353126e2f19979f7cf7dd"><code>3e85558</code></a> Update AUTHORS.txt</li> <li><a href="https://github.com/pypa/pip/commit/8d0278771c7325b04f02cb073c8ef02827cbeb93"><code>8d02787</code></a> Reclassify news fragment</li> <li><a href="https://github.com/pypa/pip/commit/f6ecf406c3929b3127ddb480ef4350542d102338"><code>f6ecf40</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12350">#12350</a> from sbidoul/readact-collecting-url</li> <li><a href="https://github.com/pypa/pip/commit/306086513bd1a6500126057492ee8b0f9a2e79dd"><code>3060865</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12335">#12335</a> from edmorley/patch-1</li> <li><a href="https://github.com/pypa/pip/commit/8f0ed32413daa411a728b50cd7776b9c02b010d5"><code>8f0ed32</code></a> Redact URLs in Collecting... logs</li> <li><a href="https://github.com/pypa/pip/commit/d1659b87e46abd0a2dcc74f2160dd52e6190e13b"><code>d1659b8</code></a> Correct issue number for NEWS entry added by <a href="https://redirect.github.com/pypa/pip/issues/12197">#12197</a></li> <li><a href="https://github.com/pypa/pip/commit/2333ef3b53a71fb7acc9e76d6ff90409576b2250"><code>2333ef3</code></a> Upgrade urllib3 to 1.26.17 (<a href="https://redirect.github.com/pypa/pip/issues/12343">#12343</a>)</li> <li><a href="https://github.com/pypa/pip/commit/496b268c1b9ce3466c08eb4819e5460a943d1793"><code>496b268</code></a> Update "Running Tests" documentation (<a href="https://redirect.github.com/pypa/pip/issues/12334">#12334</a>)</li> <li><a href="https://github.com/pypa/pip/commit/d1f0981cb2af3c72ff871b54a8a98581ccb2890a"><code>d1f0981</code></a> Merge pull request <a href="https://redirect.github.com/pypa/pip/issues/12331">#12331</a> from sbidoul/update-egg-deprecation-message</li> <li>Additional commits viewable in <a href="https://github.com/pypa/pip/compare/23.2...23.3">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
🐛 Bug Report
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)Go
Example doesn't correctly initialize struct (requires research)
On:
https://docs.aws.amazon.com/cdk/api/latest/java/index.html
That should be detecting a list of
SubnetConfiguration
structs, but is detecting a list of JSON objects.(Caused by the example not typechecking properly? Although the comment indicates it has been compiled...)
Example doesn't correctly detect constants (requires research)
In the same example on https://docs.aws.amazon.com/cdk/api/latest/java/index.html
Should look like
ec2.SubnetType.PRIVATE_WITH_NAT
.Structs don't use builders (easy fix)
On the same page https://docs.aws.amazon.com/cdk/api/latest/java/index.html
new NatInstanceProps()
is not the way to instantiate a struct. It should usenew NatInstanceProps.Builder().instanceType(...).build())
.The text was updated successfully, but these errors were encountered: