Skip to content

Commit

Permalink
Mark option value as nullable, as orig. intended
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Feb 25, 2017
1 parent 72b6898 commit c641cb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ public boolean setOption(Set<Context> contexts, String key, @Nullable String val
Map<String, String> newMap;

if (origMap == null) {
if (value == null) {
return false;
}

if ((origMap = this.options.putIfAbsent(ImmutableSet.copyOf(contexts), ImmutableMap.of(key.toLowerCase(), value))) == null) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.Map;
import java.util.Set;

import javax.annotation.Nullable;

/**
* Container for a subject's data. This container updates live, and provides raw
* data for a subject not taking into account any sort of inheritance.
Expand Down Expand Up @@ -173,7 +175,7 @@ public interface SubjectData {
* @param value The value to set.
* @return Whether the operation was successful
*/
boolean setOption(Set<Context> contexts, String key, String value);
boolean setOption(Set<Context> contexts, String key, @Nullable String value);

/**
* Clear all options in the given context combination.
Expand Down

0 comments on commit c641cb0

Please sign in to comment.