Skip to content

Code that is @AnnotatedFor("nullness") is also @AnnotatedFor("initialization") #92

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

Merged
merged 11 commits into from
Dec 8, 2024

Conversation

Ao-senXiong
Copy link
Member

No description provided.

@Ao-senXiong
Copy link
Member Author

Note: make the annotatedfor element follow alphabetical order

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some more explanation to the PR description would make it easier to reconstruct the point of the PR in the future.

As discussed, alphabetically sorting the checkers in AnnotatedFor would be good. Is the IDE support that could do this? Could we have a simple Error Prone checker that looks for this and fixes it automatically?

@wmdietl wmdietl changed the title Also annotatedfor initialization if it is annotatedfor nullness Code that is @AnnotatedFor nullness is also @AnnotatedFor initialization Oct 4, 2024
@wmdietl wmdietl changed the title Code that is @AnnotatedFor nullness is also @AnnotatedFor initialization Code that is @AnnotatedFor("nullness") is also @AnnotatedFor("initialization") Oct 4, 2024
@Ao-senXiong
Copy link
Member Author

Adding some more explanation to the PR description would make it easier to reconstruct the point of the PR in the future.

As discussed, alphabetically sorting the checkers in AnnotatedFor would be good. Is the IDE support that could do this? Could we have a simple Error Prone checker that looks for this and fixes it automatically?

@wmdietl Let me fix the CI failure first. Since this looks like a format issue, will an additional spotless feature to format the elements in annotatedfor be more consistent to handle all format issue?

@Ao-senXiong Ao-senXiong removed their assignment Nov 14, 2024
@Ao-senXiong Ao-senXiong requested a review from wmdietl November 14, 2024 00:13
@Ao-senXiong
Copy link
Member Author

@wmdietl I am not sure why I can not assign you in this repo so I pin here. I hope this can go into release and we shall update CF in AWS.

@Ao-senXiong Ao-senXiong marked this pull request as draft November 16, 2024 00:49
@Ao-senXiong
Copy link
Member Author

Don't merge at the moment as annotatedfor('initialization') did not work correctly. See eisop/checker-framework#982

@Ao-senXiong Ao-senXiong marked this pull request as ready for review November 19, 2024 02:26
@wmdietl
Copy link
Member

wmdietl commented Dec 7, 2024

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -42,7 +42,9 @@
import java.net.URISyntaxException;
import java.nio.file.FileStore;
import java.nio.file.FileSystems;
import java.nio.file.LinkOption;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the additional imports needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think ide must do this automatically... I never did that myself. I see a few places in the comment. I will remove them.

@wmdietl wmdietl merged commit 2ecd77c into eisop:master Dec 8, 2024
9 checks passed
cpovirk added a commit to cpovirk/jdk that referenced this pull request Dec 9, 2024
`getGenericSignature()` is not documented well, but I noticed that
`getGenericType()` compares the result of `getGenericSignature()`
against `null`, so that got me to verify that it can in fact return
`null`:

```
public class RecordComponentGenericSignature {
  record Rec(String s) {}

  public static void main(String[] args) {
    System.out.println(Rec.class.getRecordComponents()[0].getGenericSignature());
  }
}
```
@wmdietl
Copy link
Member

wmdietl commented Mar 16, 2025

@Ao-senXiong I just saw this file that is only AnnotatedFor for nullness, but not for initialization.

Is there a reason for this?
Can you write a script that makes it easier to validate questions about AnnotatedFor? E.g. as part of the JavaStubifier we should relatively easily be able to add such a consistency check. We probably don't want to always enforce this property, but should at least add a demo for how to do it.

Also, please add a comment somewhere that when somebody adds nullness annotations, they should also think about adding initialization.

@Ao-senXiong
Copy link
Member Author

I have Created #120 and eisop/checker-framework#1151 for above tasks.

@Ao-senXiong Ao-senXiong deleted the annotatedfor-initialization branch March 16, 2025 22:27
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 this pull request may close these issues.

2 participants