Replace the nullable annotations with guava's Optional class.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with com.sk89q.intake.argument.Namespace and review its get(Object) and get(Class) methods alongside the linked Guava Optional documentation. Search the project for nullable annotations and determine which APIs need replacement; done means the nullable annotations are replaced consistently with Optional usage and the affected behavior remains covered by the existing tests.
Written by the indexing model from the issue text.
Description
What's the point of Guava's Optional class?
Probably the single biggest disadvantage of null is that it's not obvious what it should mean in any given context: it doesn't have an illustrative name. It's not always obvious that null means "no value for this parameter" -- heck, as a return value, sometimes it means "error", or even "success" (!!), or simply "the correct answer is nothing". Optional is frequently the concept you actually mean when you make a variable nullable, but not always.
more: http://stackoverflow.com/questions/9561295/whats-the-point-of-guavas-optional-class
Optional class: http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html
Example in com.sk89q.intake.argument.Namespace
/**
* Returns the value specified by the given key.
*
* @param key The key
* @return The value, which may be null, including when the key doesn't exist
*/
public Optional<Object> get(Object key) {
if (!locals.containsKey(key)) Optional.absent();
return Optional.of(locals.get(key));
}
/**
* Get an object whose key will be the object's class.
*
* @param key The key
* @param <T> The type of object
* @return The value
*/
@SuppressWarnings("unchecked")
public <T> Optional<T> get(Class<T> key) {
if (!locals.containsKey(key)) Optional.absent();
return Optional.of((T)locals.get(key));
}
- Dominant language
- Java
- Stars
- 102
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EngineHub/Intake
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Localization support Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in EngineHub/Intake
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FasterXML/jackson-databind#6229 ·