Browse Source

RevWalk: Annotate methods documented to return "Never null" as @NonNull

Change-Id: If1a1bed4b04dd48c9573fd3c4eacbf73de40622f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
94cf82dbc5
  1. 12
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java

12
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java

@ -53,6 +53,7 @@ import java.util.EnumSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.LargeObjectException; import org.eclipse.jgit.errors.LargeObjectException;
@ -513,6 +514,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* *
* @return the current filter. Never null as a filter is always needed. * @return the current filter. Never null as a filter is always needed.
*/ */
@NonNull
public RevFilter getRevFilter() { public RevFilter getRevFilter() {
return filter; return filter;
} }
@ -552,6 +554,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} is * {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} is
* returned. * returned.
*/ */
@NonNull
public TreeFilter getTreeFilter() { public TreeFilter getTreeFilter() {
return treeFilter; return treeFilter;
} }
@ -649,6 +652,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* name of the blob object. * name of the blob object.
* @return reference to the blob object. Never null. * @return reference to the blob object. Never null.
*/ */
@NonNull
public RevBlob lookupBlob(final AnyObjectId id) { public RevBlob lookupBlob(final AnyObjectId id) {
RevBlob c = (RevBlob) objects.get(id); RevBlob c = (RevBlob) objects.get(id);
if (c == null) { if (c == null) {
@ -668,6 +672,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* name of the tree object. * name of the tree object.
* @return reference to the tree object. Never null. * @return reference to the tree object. Never null.
*/ */
@NonNull
public RevTree lookupTree(final AnyObjectId id) { public RevTree lookupTree(final AnyObjectId id) {
RevTree c = (RevTree) objects.get(id); RevTree c = (RevTree) objects.get(id);
if (c == null) { if (c == null) {
@ -690,6 +695,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* name of the commit object. * name of the commit object.
* @return reference to the commit object. Never null. * @return reference to the commit object. Never null.
*/ */
@NonNull
public RevCommit lookupCommit(final AnyObjectId id) { public RevCommit lookupCommit(final AnyObjectId id) {
RevCommit c = (RevCommit) objects.get(id); RevCommit c = (RevCommit) objects.get(id);
if (c == null) { if (c == null) {
@ -709,6 +715,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* name of the tag object. * name of the tag object.
* @return reference to the tag object. Never null. * @return reference to the tag object. Never null.
*/ */
@NonNull
public RevTag lookupTag(final AnyObjectId id) { public RevTag lookupTag(final AnyObjectId id) {
RevTag c = (RevTag) objects.get(id); RevTag c = (RevTag) objects.get(id);
if (c == null) { if (c == null) {
@ -730,6 +737,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* type of the object. Must be a valid Git object type. * type of the object. Must be a valid Git object type.
* @return reference to the object. Never null. * @return reference to the object. Never null.
*/ */
@NonNull
public RevObject lookupAny(final AnyObjectId id, final int type) { public RevObject lookupAny(final AnyObjectId id, final int type) {
RevObject r = objects.get(id); RevObject r = objects.get(id);
if (r == null) { if (r == null) {
@ -784,6 +792,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* @throws java.io.IOException * @throws java.io.IOException
* a pack file or loose object could not be read. * a pack file or loose object could not be read.
*/ */
@NonNull
public RevCommit parseCommit(final AnyObjectId id) public RevCommit parseCommit(final AnyObjectId id)
throws MissingObjectException, IncorrectObjectTypeException, throws MissingObjectException, IncorrectObjectTypeException,
IOException { IOException {
@ -811,6 +820,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* @throws java.io.IOException * @throws java.io.IOException
* a pack file or loose object could not be read. * a pack file or loose object could not be read.
*/ */
@NonNull
public RevTree parseTree(final AnyObjectId id) public RevTree parseTree(final AnyObjectId id)
throws MissingObjectException, IncorrectObjectTypeException, throws MissingObjectException, IncorrectObjectTypeException,
IOException { IOException {
@ -845,6 +855,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* @throws java.io.IOException * @throws java.io.IOException
* a pack file or loose object could not be read. * a pack file or loose object could not be read.
*/ */
@NonNull
public RevTag parseTag(final AnyObjectId id) throws MissingObjectException, public RevTag parseTag(final AnyObjectId id) throws MissingObjectException,
IncorrectObjectTypeException, IOException { IncorrectObjectTypeException, IOException {
RevObject c = parseAny(id); RevObject c = parseAny(id);
@ -870,6 +881,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {
* @throws java.io.IOException * @throws java.io.IOException
* a pack file or loose object could not be read. * a pack file or loose object could not be read.
*/ */
@NonNull
public RevObject parseAny(final AnyObjectId id) public RevObject parseAny(final AnyObjectId id)
throws MissingObjectException, IOException { throws MissingObjectException, IOException {
RevObject r = objects.get(id); RevObject r = objects.get(id);

Loading…
Cancel
Save