Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Import jsr305 and use it to mark @Nullable stuff. #158

Merged
merged 1 commit into from
May 12, 2017

Conversation

NightlyNexus
Copy link
Contributor

No description provided.

@@ -17,7 +19,7 @@
this.converter = converter;
}

@Override public QueueFile file() {
@Override public @Nonnull QueueFile file() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do this, right? It counts as a covariant type.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems plausible. If it was the other way around I'd be surprised.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the other way is not definitely not covariant.

@NightlyNexus NightlyNexus force-pushed the eric/0511.nullable branch 2 times, most recently from 9c23bf0 to fe1c47a Compare May 11, 2017 05:29
@JakeWharton
Copy link
Collaborator

Checkstyle needs updated?

@NightlyNexus
Copy link
Contributor Author

Yeah, checkstyle is complaining about the order of the annotations. It didn't complain for the other projects, but I appeased it.

@NightlyNexus NightlyNexus force-pushed the eric/0511.nullable branch 7 times, most recently from 3301d4c to d1d35fe Compare May 12, 2017 05:12
Copy link
Contributor Author

@NightlyNexus NightlyNexus left a comment

Choose a reason for hiding this comment

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

deps on the checkstyle update for the order of the annotations, if that matters.

@@ -78,12 +76,13 @@ public void testAddWithReadOnlyFileMissesMonitor() throws Exception {

// Should throw an exception.
FileObjectQueue<String> queue =
new FileObjectQueue<String>(qf, new FileObjectQueue.Converter<String>() {
new FileObjectQueue<>(qf, new FileObjectQueue.Converter<String>() {
@Override public String from(byte[] bytes) throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from and toStream only produce and accept nullable types if the generic type is nullable, so it's not needed there.

@@ -42,7 +43,7 @@ public boolean isEmpty() {
* Returns the head of the queue, or {@code null} if the queue is empty. Does not modify the
* queue.
*/
public abstract T peek() throws IOException;
public abstract @Nullable T peek() throws IOException;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this return null instead of throwing for parity with other dequeue interfaces?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes

@JakeWharton
Copy link
Collaborator

Rebase and should be good to go

@JakeWharton JakeWharton merged commit ba3a669 into square:master May 12, 2017
@NightlyNexus NightlyNexus deleted the eric/0511.nullable branch May 12, 2017 05:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants