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

How does --warnings_allowlist_file works? I tried many ways but no luck #4163

Open
bamtang-dev opened this issue May 7, 2024 · 6 comments
Open
Labels
triage-done Has been reviewed by someone on triage rotation.

Comments

@bamtang-dev
Copy link

Hello,
I'm trying to use --warnings_allowlist_file to dismiss this warning type:

warning JSC_UNRECOGNIZED_TYPE_ERROR: Bad type annotation. Unknown type XYZ

I know it is reading my file because if it doesn't find the file the compiler just crash with:

java.lang.RuntimeException: java.io.FileNotFoundException: pallowlist.txt (The system cannot find the file specified)

Is the path absolute, relative?, what is the format of the line? I feel my warning is not correct or not accepted, but no error is shown

image

@lauraharker
Copy link
Contributor

lauraharker commented May 7, 2024

Could you give an example of how your file is currently formatted?

From https://github.com/google/closure-compiler/wiki/Flags-and-Options#warning-and-error-management:

A file containing warnings to suppress. Each line should be of the form
<file-name>:<line-number>? <warning-description> (default: )

The file name should match how it's reported in the compiler error message.

@bamtang-dev
Copy link
Author

Could you give an example of how your file is currently formatted?

Yes, I just tried changing the file path to exactly match the compiler output error, this is the error:

swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

I edited the name for clarity, the type doesn't exist because it is just legacy old code and this is the only warning on our code.
I'm trying now with:

swit/js/swit/B2D/B2DBody.js:9? JSC_UNRECOGNIZED_TYPE_ERROR

but I also tried pasting the whole line exactly, not luck, maybe it is just something dumb I'm missing. I'm using v20240317 version of the compiler.

@lauraharker
Copy link
Contributor

Does this work?

swit/js/swit/phys/PhysBody.js:9 Bad type annotation. Unknown type XYZ

@bamtang-dev
Copy link
Author

bamtang-dev commented May 8, 2024

Does this work?

swit/js/swit/phys/PhysBody.js:9 Bad type annotation. Unknown type XYZ

No luck, I tried with (?) character also. For the record the class is more like X.Y.Z not sure if that is important.
Does this work for you? In the mean time we added an exception in our build scripts and are ignoring this warning, it was getting annoying. Thanks.

@rishipal rishipal added the triage-done Has been reviewed by someone on triage rotation. label May 8, 2024
@rishipal
Copy link
Contributor

Can you try pasting the warning message from JSCompiler exactly how it appears. i.e. swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

@bamtang-dev
Copy link
Author

Can you try pasting the warning message from JSCompiler exactly how it appears. i.e. swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

I remember I tried that, just in case I tried all these, none works:

swit/js/swit/B2D/B2DBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9:13? WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9? WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9 WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9? Bad type annotation. Unknown type XYZ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-done Has been reviewed by someone on triage rotation.
Projects
None yet
Development

No branches or pull requests

3 participants