-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add JSpecify annotations to 10 graphql.language classes #4217
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
70d3d76
Initial plan
Copilot 9d0253c
Add JSpecify annotations to 10 classes in graphql.language package
Copilot 5842edf
Merge branch 'master' into copilot/add-jspecify-annotations
dondonz a87a8a3
Not nullable when Node is created
dondonz dcb7a66
Remove unnecessary null check
dondonz 2d02ff0
Add nullable to input that ought to be nullable
dondonz 2612804
Merge branch 'master' into copilot/add-jspecify-annotations
dondonz 21261ed
Remove already-annotated classes from JSpecify exemption list
dondonz 9d851ec
Merge remote-tracking branch 'origin/master' into copilot/add-jspecif…
dondonz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,25 @@ | ||
| package graphql.language; | ||
|
|
||
| import graphql.PublicApi; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| @PublicApi | ||
| @NullMarked | ||
| public abstract class AbstractDescribedNode<T extends Node> extends AbstractNode<T> implements DescribedNode<T> { | ||
|
|
||
| protected Description description; | ||
| protected @Nullable Description description; | ||
|
|
||
| public AbstractDescribedNode(SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData, Description description) { | ||
| public AbstractDescribedNode(@Nullable SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData, @Nullable Description description) { | ||
| super(sourceLocation, comments, ignoredChars, additionalData); | ||
| this.description = description; | ||
| } | ||
|
|
||
| @Override | ||
| public Description getDescription() { | ||
| public @Nullable Description getDescription() { | ||
| return description; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,19 @@ | ||
| package graphql.language; | ||
|
|
||
| import graphql.PublicApi; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| /** | ||
| * Represents a node that can contain a description. | ||
| */ | ||
| @PublicApi | ||
| @NullMarked | ||
| public interface DescribedNode<T extends Node> extends Node<T> { | ||
|
|
||
| /** | ||
| * @return the description of this node | ||
| */ | ||
| Description getDescription(); | ||
| @Nullable Description getDescription(); | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,19 @@ | ||
| package graphql.language; | ||
|
|
||
| import graphql.PublicApi; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| @PublicApi | ||
| @NullMarked | ||
| public class Description implements Serializable { | ||
| public final String content; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An interesting note: descriptions do not need to exist on GraphQL schema elements. However this is the AST representation - this Description element is only created when one exists. |
||
| public final SourceLocation sourceLocation; | ||
| public final @Nullable SourceLocation sourceLocation; | ||
| public final boolean multiLine; | ||
|
|
||
| public Description(String content, SourceLocation sourceLocation, boolean multiLine) { | ||
| public Description(String content, @Nullable SourceLocation sourceLocation, boolean multiLine) { | ||
| this.content = content; | ||
| this.sourceLocation = sourceLocation; | ||
| this.multiLine = multiLine; | ||
|
|
@@ -20,7 +23,7 @@ public String getContent() { | |
| return content; | ||
| } | ||
|
|
||
| public SourceLocation getSourceLocation() { | ||
| public @Nullable SourceLocation getSourceLocation() { | ||
| return sourceLocation; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like code get missed here in diff terms??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it because the input is not nullable - so the question becomes can the input be nullable?
Is it possible or normal behaviour to pass in a null node into the printer?