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

No error when stubs are invalid #4586

Closed
xenoterracide opened this issue Apr 28, 2021 · 2 comments · Fixed by #4629
Closed

No error when stubs are invalid #4586

xenoterracide opened this issue Apr 28, 2021 · 2 comments · Fixed by #4629

Comments

@xenoterracide
Copy link

I've been creating some stubs, mostly invalid the first time around, but there is no error telling me this. I've done things as obvious as forgetting the return type

@Nullable getParent();

or as non obvious as excluding final on a class

public class Objects {

but checker didn't tell me this, which makes it harder to tell why an error isn't caught, and also makes it more likely that an error isn't caught at all because you don't realize that your checks are broken.

@mernst
Copy link
Member

mernst commented Apr 28, 2021

Please use the -AstubWarnIfNotFound command-line option.
It is described in manual section "Troubleshooting stub libraries".

I feel your pain about the dumb typos -- I have done that a lot too.

These warnings are not enabled by default because they would produce too much output. An example of an innocuous warning is when a stub file is written for library version B but an earlier version of the library is on the classpath; a warning is issued for every method in the stub file but not in the earlier version of the library. (This happens a lot for the JDK, and also for other libraries.)

Perhaps the warnings could be enabled by default for any stub file provided via the -Astubs command-line option, but not stub files built into the checker.

@xenoterracide
Copy link
Author

xenoterracide commented Apr 28, 2021

it looks like it is throwing warnings, but it might be nicer if it threw errors if the files are not parseable. Also, big fan of errors by default, and allow downgrading to warnings instead, etc.

I'm presuming that parsing errors can happen without also processing the library, but I don't know that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants