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

Optional checker: implicit @MaybePresent annotations are inserted in .ajava files #6232

Open
jyoo980 opened this issue Oct 10, 2023 · 3 comments · May be fixed by #6254
Open

Optional checker: implicit @MaybePresent annotations are inserted in .ajava files #6232

jyoo980 opened this issue Oct 10, 2023 · 3 comments · May be fixed by #6254

Comments

@jyoo980
Copy link
Contributor

jyoo980 commented Oct 10, 2023

Summary

An execution of WPI on a Java project with the Optional Checker will yield a set of .ajava files where the implicit @MaybePresent annotation is inserted for most (if not all) method arguments and return types, e.g.,

@org.checkerframework.dataflow.qual.Impure
public @org.checkerframework.checker.optional.qual.MaybePresent ResolvedReferenceTypeDeclaration toTypeDeclaration(@org.checkerframework.checker.optional.qual.MaybePresent JavaSymbolSolver this, @org.checkerframework.checker.optional.qual.MaybePresent Node node)

A research discussion with @mernst and @rjust showed that this was not an error; since .ajava files are not meant to be human-read.

That said, I am opening this issue to at least document the possibility that @MaybePresent annotations will no longer be inserted into the .ajava files. The manual suggests that the

[MaybePresent] type is a default value, so programmers do not have to write it

See this manual section for details.

@kelloggm
Copy link
Contributor

@jyoo980 This is expected (though not really desirable) WPI behavior: effectively, WPI writes all "true" annotations, even those that are equivalent to the default.

WPI makes an effort to avoid doing this when it can: see

. This code only works for qualifiers that are marked as @InvisibleQualifer, so it's only useful for qualifiers that the type system designer genuinely intended to never be written. It would be great if WPI could do a better job of filtering "default" qualifiers than this.

@mernst
Copy link
Member

mernst commented Oct 10, 2023

A good first step would be for .ajava files not to contain annotations that do not satisfy the @RelevantJavaTypes meta-annotation.

@mernst mernst linked a pull request Oct 22, 2023 that will close this issue
@mernst
Copy link
Member

mernst commented Oct 22, 2023

#6254 will not solve the problem of inserting implicit annotations, but it makes a big step by not inserting irrelevant annotations.

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.

3 participants