summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-11-25 21:19:05 +0100
committerAndrey Loskutov <loskutov@gmx.de>2015-11-25 21:19:05 +0100
commit830117e761bddc182e4dc57150ca661976868203 (patch)
treeac4b7c5a369215f9825c6e2b85f896f302ebe3b5 /org.eclipse.jgit
parent1020f40813356ffa4b2576f38c749fc0db30ea20 (diff)
downloadjgit-830117e761bddc182e4dc57150ca661976868203.tar.gz
jgit-830117e761bddc182e4dc57150ca661976868203.zip
Null-annotated RefDatabase class
No other code changes except adding nullness annotations. Change-Id: If2606fb208f6690bd4fd7ad953e709a3ebd6398c Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
index b62033cbd2..986666f2f4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
@@ -51,6 +51,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.annotations.Nullable;
+
/**
* Abstraction of name to {@link ObjectId} mapping.
* <p>
@@ -132,6 +135,7 @@ public abstract class RefDatabase {
* @since 2.3
* @see #isNameConflicting(String)
*/
+ @NonNull
public Collection<String> getConflictingNames(String name)
throws IOException {
Map<String, Ref> allRefs = getRefs(ALL);
@@ -169,6 +173,7 @@ public abstract class RefDatabase {
* @throws IOException
* the reference space cannot be accessed.
*/
+ @NonNull
public abstract RefUpdate newUpdate(String name, boolean detach)
throws IOException;
@@ -183,6 +188,7 @@ public abstract class RefDatabase {
* @throws IOException
* the reference space cannot be accessed.
*/
+ @NonNull
public abstract RefRename newRename(String fromName, String toName)
throws IOException;
@@ -193,6 +199,7 @@ public abstract class RefDatabase {
*
* @return a new batch update object.
*/
+ @NonNull
public BatchRefUpdate newBatchUpdate() {
return new BatchRefUpdate(this);
}
@@ -223,6 +230,7 @@ public abstract class RefDatabase {
* @throws IOException
* the reference space cannot be accessed.
*/
+ @Nullable
public abstract Ref getRef(String name) throws IOException;
/**
@@ -238,6 +246,7 @@ public abstract class RefDatabase {
* the reference space cannot be accessed.
* @since 4.1
*/
+ @Nullable
public Ref exactRef(String name) throws IOException {
Ref ref = getRef(name);
if (ref == null || !name.equals(ref.getName())) {
@@ -261,6 +270,7 @@ public abstract class RefDatabase {
* the reference space cannot be accessed.
* @since 4.1
*/
+ @NonNull
public Map<String, Ref> exactRef(String... refs) throws IOException {
Map<String, Ref> result = new HashMap<>(refs.length);
for (String name : refs) {
@@ -285,6 +295,7 @@ public abstract class RefDatabase {
* the reference space cannot be accessed.
* @since 4.1
*/
+ @Nullable
public Ref firstExactRef(String... refs) throws IOException {
for (String name : refs) {
Ref ref = exactRef(name);
@@ -308,6 +319,7 @@ public abstract class RefDatabase {
* @throws IOException
* the reference space cannot be accessed.
*/
+ @NonNull
public abstract Map<String, Ref> getRefs(String prefix) throws IOException;
/**
@@ -322,6 +334,7 @@ public abstract class RefDatabase {
* @throws IOException
* the reference space cannot be accessed.
*/
+ @NonNull
public abstract List<Ref> getAdditionalRefs() throws IOException;
/**
@@ -338,10 +351,11 @@ public abstract class RefDatabase {
* @return {@code ref} if {@code ref.isPeeled()} is true; otherwise a new
* Ref object representing the same data as Ref, but isPeeled() will
* be true and getPeeledObjectId() will contain the peeled object
- * (or null).
+ * (or {@code null}).
* @throws IOException
* the reference space or object space cannot be accessed.
*/
+ @NonNull
public abstract Ref peel(Ref ref) throws IOException;
/**
@@ -365,9 +379,10 @@ public abstract class RefDatabase {
* @param name
* short name of ref to find, e.g. "master" to find
* "refs/heads/master" in map.
- * @return The first ref matching the name, or null if not found.
+ * @return The first ref matching the name, or {@code null} if not found.
* @since 3.4
*/
+ @Nullable
public static Ref findRef(Map<String, Ref> map, String name) {
for (String prefix : SEARCH_PATH) {
String fullname = prefix + name;