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

Fix the errors reported by NullAway #2776

Merged
merged 3 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'com.google.osdetector' version '1.6.2' apply false
// If you want to change `org.jetbrains.kotlin.jvm` version,
// If you want to change `org.jetbrains.kotlin.jvm` version,
// you also need to change `org.jetbrains.kotlin:kotlin-allopen` version in `dependencies.yml`.
id 'org.jetbrains.kotlin.jvm' version '1.3.72' apply false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,13 @@ public ClientOptions options() {

@Override
public EndpointGroup endpointGroup() {
assert endpointGroup != null;
return endpointGroup;
}

@Override
public Endpoint endpoint() {
assert endpoint != null;
return endpoint;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void run() {
servedFromCache = false;
numAttemptsSoFar = 1;

if (entry.address().equals(address) && entry.ttlMillis() == ttlMillis) {
if (address.equals(entry.address()) && entry.ttlMillis() == ttlMillis) {
scheduleRefresh(ttlMillis);
} else {
// Replace the old entry with the new one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ private static final class KnownTypesByString {
.distinct()
.collect(toImmutableMap(MediaType::toString, Function.identity(), (a, b) -> a));

@Nullable
static MediaType get(String input) {
return KNOWN_TYPES_BY_STRING.get(input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ ScheduledFuture<?> timeoutFuture() {
return timeoutFuture;
}

@Nullable
@VisibleForTesting
TimeoutTask timeoutTask() {
return timeoutTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public final class ObjectCollectingUtil {
* The {@link Class} instance of {@code reactor.core.publisher.Mono} of
* <a href="https://projectreactor.io/">Project Reactor</a>.
*/
@Nullable
private static final Class<?> MONO_CLASS;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ static <T extends Annotation> List<T> find(AnnotatedElement element, Class<T> an

private static <T extends Annotation> void findMetaAnnotations(
Builder<T> builder, Annotation annotation,
Class<T> annotationType, Class<? extends Annotation> containerType) {
Class<T> annotationType, @Nullable Class<? extends Annotation> containerType) {
Copy link
Member

Choose a reason for hiding this comment

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

👍

findMetaAnnotations(builder, annotation, annotationType, containerType,
Collections.newSetFromMap(new IdentityHashMap<>()));
}

private static <T extends Annotation> boolean findMetaAnnotations(
Builder<T> builder, Annotation annotation,
Class<T> annotationType, Class<? extends Annotation> containerType,
Class<T> annotationType, @Nullable Class<? extends Annotation> containerType,
Set<Class<? extends Annotation>> visitedAnnotationTypes) {

final Class<? extends Annotation> actualAnnotationType = annotation.getClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ private static FieldInfo addFieldDocString(NamedTypeInfo parent, FieldInfo field
docString(parent.name() + '/' + field.name(), field.docString(), docStrings));
}

@Nullable
private static String docString(
String key, @Nullable String currentDocString, Map<String, String> docStrings) {
return currentDocString != null ? currentDocString : docStrings.get(key);
Expand Down