[bug] JSII Compilation error for Class Decorator#33213
[bug] JSII Compilation error for Class Decorator#33213pcheungamz wants to merge 2 commits intoaws:mainfrom
Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter fails with the following errors:
❌ The title prefix of this pull request must be one of "feat|fix|build|chore|ci|docs|style|refactor|perf|test|revert"
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing To prevent automatic closure:
This PR will automatically close in 7 days if no action is taken. |
`jsii` used to fail when trying to generate deprecation warnings and
given a statement like this:
```ts
export function propertyInjectionDecorator<T extends Constructor>(ctr: T) {
// Important for the bug: the anonymous class extends something, *and*
// declares a method.
return class extends ctr {
public someMethod(): string {
return 'abc';
}
};
}
```
The reason is that during generation of deprecation warnings we iterate
over all classes and methods (both exported and unexported), and
generate a symbol identifier for every method; but this class is
anonymous
so it doesn't have a symbol, and generating the identifier fails with
the error:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at symbolIdentifier (.../jsii/lib/common/symbol-id.js:40:17)
```
Handle this by handling the case where we don't have a symbol
and returning `undefined`.
Fixes aws/aws-cdk#33213
---
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
---------
Co-authored-by: Eli Polonsky <Eli.polonsky@gmail.com>
|
Comments on closed issues and PRs are hard for our team to see. |
`jsii` used to fail when trying to generate deprecation warnings and
given a statement like this:
```ts
export function propertyInjectionDecorator<T extends Constructor>(ctr: T) {
// Important for the bug: the anonymous class extends something, *and*
// declares a method.
return class extends ctr {
public someMethod(): string {
return 'abc';
}
};
}
```
The reason is that during generation of deprecation warnings we iterate
over all classes and methods (both exported and unexported), and
generate a symbol identifier for every method; but this class is
anonymous
so it doesn't have a symbol, and generating the identifier fails with
the error:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at symbolIdentifier (.../jsii/lib/common/symbol-id.js:40:17)
```
Handle this by handling the case where we don't have a symbol
and returning `undefined`.
Fixes aws/aws-cdk#33213
---
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
---------
Co-authored-by: Eli Polonsky <Eli.polonsky@gmail.com>
(cherry picked from commit dbd4506)
`jsii` used to fail when trying to generate deprecation warnings and
given a statement like this:
```ts
export function propertyInjectionDecorator<T extends Constructor>(ctr: T) {
// Important for the bug: the anonymous class extends something, *and*
// declares a method.
return class extends ctr {
public someMethod(): string {
return 'abc';
}
};
}
```
The reason is that during generation of deprecation warnings we iterate
over all classes and methods (both exported and unexported), and
generate a symbol identifier for every method; but this class is
anonymous
so it doesn't have a symbol, and generating the identifier fails with
the error:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at symbolIdentifier (.../jsii/lib/common/symbol-id.js:40:17)
```
Handle this by handling the case where we don't have a symbol
and returning `undefined`.
Fixes aws/aws-cdk#33213
---
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
---------
Co-authored-by: Eli Polonsky <Eli.polonsky@gmail.com>
(cherry picked from commit dbd4506)
`jsii` used to fail when trying to generate deprecation warnings and
given a statement like this:
```ts
export function propertyInjectionDecorator<T extends Constructor>(ctr: T) {
// Important for the bug: the anonymous class extends something, *and*
// declares a method.
return class extends ctr {
public someMethod(): string {
return 'abc';
}
};
}
```
The reason is that during generation of deprecation warnings we iterate
over all classes and methods (both exported and unexported), and
generate a symbol identifier for every method; but this class is
anonymous
so it doesn't have a symbol, and generating the identifier fails with
the error:
```
TypeError: Cannot read properties of undefined (reading 'flags')
at symbolIdentifier (.../jsii/lib/common/symbol-id.js:40:17)
```
Handle this by handling the case where we don't have a symbol
and returning `undefined`.
Fixes aws/aws-cdk#33213
---
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
---------
Co-authored-by: Eli Polonsky <Eli.polonsky@gmail.com>
(cherry picked from commit dbd4506)
Reason for this change
A simple way to demo the JSII Compilation error:
Description of changes
New file containing Class Decorator.
Describe any new or updated permissions being added
None
Description of how you validated changes
yarn buildinpackage/aws-cdk-libproduces JSII error.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license