Add missing @Override found by ErrorProne

Change-Id: I585242507815aad4aa0103fd55a6c369e342ab33
This commit is contained in:
Shawn Pearce 2016-11-14 14:51:08 -08:00 committed by David Pursehouse
parent 8208da2f59
commit ca4ef2d24b
4 changed files with 25 additions and 17 deletions

View File

@ -182,10 +182,12 @@ public FileRepository(final BaseRepositoryBuilder options) throws IOException {
getFS()); getFS());
else else
systemConfig = new FileBasedConfig(null, FS.DETECTED) { systemConfig = new FileBasedConfig(null, FS.DETECTED) {
@Override
public void load() { public void load() {
// empty, do not load // empty, do not load
} }
@Override
public boolean isOutdated() { public boolean isOutdated() {
// regular class would bomb here // regular class would bomb here
return false; return false;
@ -202,6 +204,7 @@ public boolean isOutdated() {
loadRepoConfig(); loadRepoConfig();
repoConfig.addChangeListener(new ConfigChangedListener() { repoConfig.addChangeListener(new ConfigChangedListener() {
@Override
public void onConfigChanged(ConfigChangedEvent event) { public void onConfigChanged(ConfigChangedEvent event) {
fireEvent(event); fireEvent(event);
} }
@ -284,6 +287,7 @@ private void loadRepoConfig() throws IOException {
* @throws IOException * @throws IOException
* in case of IO problem * in case of IO problem
*/ */
@Override
public void create(boolean bare) throws IOException { public void create(boolean bare) throws IOException {
final FileBasedConfig cfg = getConfig(); final FileBasedConfig cfg = getConfig();
if (cfg.getFile().exists()) { if (cfg.getFile().exists()) {
@ -381,21 +385,20 @@ public File getObjectsDirectory() {
return objectDatabase.getDirectory(); return objectDatabase.getDirectory();
} }
/** /** @return the object database storing this repository's data. */
* @return the object database which stores this repository's data. @Override
*/
public ObjectDirectory getObjectDatabase() { public ObjectDirectory getObjectDatabase() {
return objectDatabase; return objectDatabase;
} }
/** @return the reference database which stores the reference namespace. */ /** @return the reference database which stores the reference namespace. */
@Override
public RefDatabase getRefDatabase() { public RefDatabase getRefDatabase() {
return refs; return refs;
} }
/** /** @return the configuration of this repository. */
* @return the configuration of this repository @Override
*/
public FileBasedConfig getConfig() { public FileBasedConfig getConfig() {
if (systemConfig.isOutdated()) { if (systemConfig.isOutdated()) {
try { try {
@ -484,6 +487,7 @@ private File descriptionFile() {
* *
* @return unmodifiable collection of other known objects. * @return unmodifiable collection of other known objects.
*/ */
@Override
public Set<ObjectId> getAdditionalHaves() { public Set<ObjectId> getAdditionalHaves() {
HashSet<ObjectId> r = new HashSet<ObjectId>(); HashSet<ObjectId> r = new HashSet<ObjectId>();
for (AlternateHandle d : objectDatabase.myAlternates()) { for (AlternateHandle d : objectDatabase.myAlternates()) {
@ -522,9 +526,7 @@ public void scanForRepoChanges() throws IOException {
detectIndexChanges(); detectIndexChanges();
} }
/** /** Detect index changes. */
* Detect index changes.
*/
private void detectIndexChanges() { private void detectIndexChanges() {
if (isBare()) if (isBare())
return; return;
@ -548,6 +550,7 @@ public void notifyIndexChanged() {
* named ref does not exist. * named ref does not exist.
* @throws IOException the ref could not be accessed. * @throws IOException the ref could not be accessed.
*/ */
@Override
public ReflogReader getReflogReader(String refName) throws IOException { public ReflogReader getReflogReader(String refName) throws IOException {
Ref ref = findRef(refName); Ref ref = findRef(refName);
if (ref != null) if (ref != null)
@ -585,6 +588,7 @@ protected AttributesNodeProviderImpl(Repository repo) {
globalAttributesNode = new GlobalAttributesNode(repo); globalAttributesNode = new GlobalAttributesNode(repo);
} }
@Override
public AttributesNode getInfoAttributesNode() throws IOException { public AttributesNode getInfoAttributesNode() throws IOException {
if (infoAttributesNode instanceof InfoAttributesNode) if (infoAttributesNode instanceof InfoAttributesNode)
infoAttributesNode = ((InfoAttributesNode) infoAttributesNode) infoAttributesNode = ((InfoAttributesNode) infoAttributesNode)
@ -592,6 +596,7 @@ public AttributesNode getInfoAttributesNode() throws IOException {
return infoAttributesNode; return infoAttributesNode;
} }
@Override
public AttributesNode getGlobalAttributesNode() throws IOException { public AttributesNode getGlobalAttributesNode() throws IOException {
if (globalAttributesNode instanceof GlobalAttributesNode) if (globalAttributesNode instanceof GlobalAttributesNode)
globalAttributesNode = ((GlobalAttributesNode) globalAttributesNode) globalAttributesNode = ((GlobalAttributesNode) globalAttributesNode)
@ -625,5 +630,4 @@ public void autoGC(ProgressMonitor monitor) {
throw new JGitInternalException(JGitText.get().gcFailed, e); throw new JGitInternalException(JGitText.get().gcFailed, e);
} }
} }
} }

View File

@ -143,6 +143,7 @@ public V get(final AnyObjectId toFind) {
* object to find. * object to find.
* @return true if the mapping exists for this object; false otherwise. * @return true if the mapping exists for this object; false otherwise.
*/ */
@Override
public boolean contains(final AnyObjectId toFind) { public boolean contains(final AnyObjectId toFind) {
return get(toFind) != null; return get(toFind) != null;
} }
@ -219,20 +220,20 @@ public boolean isEmpty() {
return size == 0; return size == 0;
} }
@Override
public Iterator<V> iterator() { public Iterator<V> iterator() {
return new Iterator<V>() { return new Iterator<V>() {
private int found; private int found;
private int dirIdx; private int dirIdx;
private int tblIdx; private int tblIdx;
private V next; private V next;
@Override
public boolean hasNext() { public boolean hasNext() {
return found < size; return found < size;
} }
@Override
public V next() { public V next() {
if (next != null) if (next != null)
return found(next); return found(next);
@ -261,6 +262,7 @@ private V found(V v) {
return v; return v;
} }
@Override
public void remove() { public void remove() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -107,8 +107,7 @@
* This class is thread-safe. * This class is thread-safe.
*/ */
public abstract class Repository implements AutoCloseable { public abstract class Repository implements AutoCloseable {
private static Logger LOG = LoggerFactory.getLogger(Repository.class); private static final Logger LOG = LoggerFactory.getLogger(Repository.class);
private static final ListenerList globalListeners = new ListenerList(); private static final ListenerList globalListeners = new ListenerList();
/** @return the global listener list observing all events in this JVM. */ /** @return the global listener list observing all events in this JVM. */
@ -869,6 +868,7 @@ public void incrementOpen() {
} }
/** Decrement the use count, and maybe close resources. */ /** Decrement the use count, and maybe close resources. */
@Override
public void close() { public void close() {
int newCount = useCnt.decrementAndGet(); int newCount = useCnt.decrementAndGet();
if (newCount == 0) { if (newCount == 0) {
@ -902,8 +902,9 @@ protected void doClose() {
getRefDatabase().close(); getRefDatabase().close();
} }
@NonNull
@SuppressWarnings("nls") @SuppressWarnings("nls")
@Override
@NonNull
public String toString() { public String toString() {
String desc; String desc;
File directory = getDirectory(); File directory = getDirectory();
@ -1175,7 +1176,7 @@ public DirCache lockDirCache() throws NoWorkTreeException,
// we want DirCache to inform us so that we can inform registered // we want DirCache to inform us so that we can inform registered
// listeners about index changes // listeners about index changes
IndexChangedListener l = new IndexChangedListener() { IndexChangedListener l = new IndexChangedListener() {
@Override
public void onIndexChanged(IndexChangedEvent event) { public void onIndexChanged(IndexChangedEvent event) {
notifyIndexChanged(); notifyIndexChanged();
} }

View File

@ -430,6 +430,7 @@ public final File getFile() {
return path; return path;
} }
@Override
public Repository open(final boolean mustExist) throws IOException { public Repository open(final boolean mustExist) throws IOException {
if (mustExist && !isGitRepository(path, fs)) if (mustExist && !isGitRepository(path, fs))
throw new RepositoryNotFoundException(path); throw new RepositoryNotFoundException(path);