Skip to content
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

fix(jsii): deprecation warnings use this.constructor before calling super #3528

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,15 @@
"contributions": [
"bug"
]
},
{
"login": "3p3r",
"name": "Sepehr Laal",
"avatar_url": "https://avatars.githubusercontent.com/u/5657848?v=4",
"profile": "https://sepehrlaal.com/",
"contributions": [
"bug"
]
}
],
"repoType": "github",
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,46 +192,49 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center"><a href="https://punch.dev/"><img src="https://avatars1.githubusercontent.com/u/38672686?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sam Goodwin</b></sub></a><br /><a href="https://github.com/aws/jsii/pulls?q=is%3Apr+reviewed-by%3Asam-goodwin" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://skorfmann.com/"><img src="https://avatars1.githubusercontent.com/u/136789?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sebastian Korfmann</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Askorfmann+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/commits?author=skorfmann" title="Code">💻</a> <a href="https://github.com/aws/jsii/issues?q=author%3Askorfmann+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="https://sepehrlaal.com/"><img src="https://avatars.githubusercontent.com/u/5657848?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sepehr Laal</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3A3p3r+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://digitalsanctum.com/"><img src="https://avatars3.githubusercontent.com/u/30923?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Shane Witbeck</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Adigitalsanctum+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="https://github.com/shivlaks"><img src="https://avatars0.githubusercontent.com/u/32604953?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Shiv Lakshminarayan</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=shivlaks" title="Code">💻</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Ashivlaks" title="Maintenance">🚧</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+reviewed-by%3Ashivlaks" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/SomayaB"><img src="https://avatars3.githubusercontent.com/u/23043132?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Somaya</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=SomayaB" title="Code">💻</a> <a href="https://github.com/aws/jsii/issues?q=author%3ASomayaB+label%3Afeature-request" title="Feature requests">🤔</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3ASomayaB" title="Maintenance">🚧</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+reviewed-by%3ASomayaB" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://gitter.im/"><img src="https://avatars2.githubusercontent.com/u/8518239?v=4?s=100" width="100px;" alt=""/><br /><sub><b>The Gitter Badger</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=gitter-badger" title="Code">💻</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Agitter-badger" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://medium.com/@thomaspoignant"><img src="https://avatars2.githubusercontent.com/u/17908063?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thomas Poignant</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Athomaspoignant+label%3Abug" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="https://medium.com/@thomaspoignant"><img src="https://avatars2.githubusercontent.com/u/17908063?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thomas Poignant</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Athomaspoignant+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/ThomasSteinbach"><img src="https://avatars0.githubusercontent.com/u/1683246?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thomas Steinbach</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3AThomasSteinbach+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/hoegertn"><img src="https://avatars2.githubusercontent.com/u/1287829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Thorsten Hoeger</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=hoegertn" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/serverlessunicorn"><img src="https://avatars1.githubusercontent.com/u/54867311?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tim Wagner</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Aserverlessunicorn+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/issues?q=author%3Aserverlessunicorn+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="https://github.com/tobli"><img src="https://avatars3.githubusercontent.com/u/540266?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tobias Lidskog</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=tobli" title="Code">💻</a></td>
<td align="center"><a href="https://ty.coghlan.dev/"><img src="https://avatars2.githubusercontent.com/u/15920577?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ty Coghlan</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3AOphirr33+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/tvanhens"><img src="https://avatars1.githubusercontent.com/u/5342795?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler van Hensbergen</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Atvanhens+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="http://ultidev.com/Products/"><img src="https://avatars1.githubusercontent.com/u/757185?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Hrybok</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Avgribok+label%3Abug" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="http://ultidev.com/Products/"><img src="https://avatars1.githubusercontent.com/u/757185?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Hrybok</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Avgribok+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/Lanayx"><img src="https://avatars2.githubusercontent.com/u/3329606?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vladimir Shchur</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3ALanayx+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="http://yanex.org/"><img src="https://avatars2.githubusercontent.com/u/95996?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yan Zhulanow</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=yanex" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/yglcode"><img src="https://avatars.githubusercontent.com/u/11893614?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yigong Liu</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Ayglcode+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/issues?q=author%3Ayglcode+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="https://github.com/ZachBien"><img src="https://avatars.githubusercontent.com/u/1245628?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zach Bienenfeld</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3AZachBien+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/ajnarang"><img src="https://avatars3.githubusercontent.com/u/52025281?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ajnarang</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Aajnarang+label%3Afeature-request" title="Feature requests">🤔</a></td>
<td align="center"><a href="https://github.com/aniljava"><img src="https://avatars.githubusercontent.com/u/412569?v=4?s=100" width="100px;" alt=""/><br /><sub><b>aniljava</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=aniljava" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/arnogeurts-sqills"><img src="https://avatars.githubusercontent.com/u/79304871?v=4?s=100" width="100px;" alt=""/><br /><sub><b>arnogeurts-sqills</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Aarnogeurts-sqills+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/commits?author=arnogeurts-sqills" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/arnogeurts-sqills"><img src="https://avatars.githubusercontent.com/u/79304871?v=4?s=100" width="100px;" alt=""/><br /><sub><b>arnogeurts-sqills</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Aarnogeurts-sqills+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/commits?author=arnogeurts-sqills" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/deccy-mcc"><img src="https://avatars0.githubusercontent.com/u/45844893?v=4?s=100" width="100px;" alt=""/><br /><sub><b>deccy-mcc</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Adeccy-mcc+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/apps/dependabot-preview"><img src="https://avatars3.githubusercontent.com/in/2141?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot-preview[bot]</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Adependabot-preview[bot]+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Adependabot-preview[bot]" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/apps/dependabot"><img src="https://avatars0.githubusercontent.com/in/29110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot[bot]</b></sub></a><br /><a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Adependabot[bot]" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/dheffx"><img src="https://avatars0.githubusercontent.com/u/22029918?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dheffx</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Adheffx+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/gregswdl"><img src="https://avatars0.githubusercontent.com/u/47365273?v=4?s=100" width="100px;" alt=""/><br /><sub><b>gregswdl</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Agregswdl+label%3Abug" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/guyroberts21"><img src="https://avatars.githubusercontent.com/u/47118902?v=4?s=100" width="100px;" alt=""/><br /><sub><b>guyroberts21</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=guyroberts21" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/mattBrzezinski"><img src="https://avatars.githubusercontent.com/u/4356074?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mattBrzezinski</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=mattBrzezinski" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/mattBrzezinski"><img src="https://avatars.githubusercontent.com/u/4356074?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mattBrzezinski</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=mattBrzezinski" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/mergify"><img src="https://avatars.githubusercontent.com/u/18240476?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mergify</b></sub></a><br /><a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Amergify" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/apps/mergify"><img src="https://avatars1.githubusercontent.com/in/10562?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mergify[bot]</b></sub></a><br /><a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Amergify[bot]" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/nathannaveen"><img src="https://avatars.githubusercontent.com/u/42319948?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nathannaveen</b></sub></a><br /><a href="https://github.com/aws/jsii/pulls?q=is%3Apr+author%3Anathannaveen" title="Maintenance">🚧</a></td>
<td align="center"><a href="https://github.com/seiyashima"><img src="https://avatars2.githubusercontent.com/u/4947101?v=4?s=100" width="100px;" alt=""/><br /><sub><b>seiyashima42</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Aseiyashima+label%3Abug" title="Bug reports">🐛</a> <a href="https://github.com/aws/jsii/commits?author=seiyashima" title="Code">💻</a> <a href="https://github.com/aws/jsii/commits?author=seiyashima" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/sullis"><img src="https://avatars3.githubusercontent.com/u/30938?v=4?s=100" width="100px;" alt=""/><br /><sub><b>sullis</b></sub></a><br /><a href="https://github.com/aws/jsii/commits?author=sullis" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/vaneek"><img src="https://avatars1.githubusercontent.com/u/8113305?v=4?s=100" width="100px;" alt=""/><br /><sub><b>vaneek</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Avaneek+label%3Abug" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/wendysophie"><img src="https://avatars.githubusercontent.com/u/54415551?v=4?s=100" width="100px;" alt=""/><br /><sub><b>wendysophie</b></sub></a><br /><a href="https://github.com/aws/jsii/issues?q=author%3Awendysophie+label%3Abug" title="Bug reports">🐛</a></td>
</tr>
</table>
Expand Down
5 changes: 1 addition & 4 deletions packages/jsii/lib/transforms/deprecation-warnings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,7 @@ class Transformer {
node.body,
insertStatements(
node.body,
wrapWithRethrow(
statements,
ts.createPropertyAccess(ts.createThis(), 'constructor'),
),
wrapWithRethrow(statements, node.parent.name!),
),
),
) as any;
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii/test/deprecation-warnings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,15 @@ describe('Call injections', () => {
}
catch (error) {
if (process.env.JSII_DEBUG !== \\"1\\" && error.name === \\"DeprecationError\\") {
Error.captureStackTrace(error, this.constructor);
Error.captureStackTrace(error, Foo);
}
throw error;
} }
}
exports.Foo = Foo;
_a = JSII_RTTI_SYMBOL_1;
Foo[_a] = { fqn: \\"testpkg.Foo\\", version: \\"0.0.1\\" };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDSSxxQ0FBcUM7QUFDckMsTUFBYSxHQUFHO0lBQ2Q7Ozs7Ozs7O09BQWU7O0FBRGpCLGtCQUVDIiwic291cmNlc0NvbnRlbnQiOlsiXG4gICAgLyoqIEBkZXByZWNhdGVkIFVzZSBzb21ldGhpbmcgZWxzZSAqL1xuICAgIGV4cG9ydCBjbGFzcyBGb28ge1xuICAgICAgY29uc3RydWN0b3IoKXt9XG4gICAgfVxuICAiXX0="
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDSSxxQ0FBcUM7QUFDckMsTUFBYSxHQUFHO0lBQ2Q7Ozs7OzJDQURXLEdBQUc7OztPQUNDOztBQURqQixrQkFFQyIsInNvdXJjZXNDb250ZW50IjpbIlxuICAgIC8qKiBAZGVwcmVjYXRlZCBVc2Ugc29tZXRoaW5nIGVsc2UgKi9cbiAgICBleHBvcnQgY2xhc3MgRm9vIHtcbiAgICAgIGNvbnN0cnVjdG9yKCl7fVxuICAgIH1cbiAgIl19"
`);
});
});
Expand Down