From 1773002a3446c93ab03997b65139fc7d014599b9 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Sun, 24 May 2015 09:31:17 +0200 Subject: [PATCH] Cleanup code and Eclipse compile errors in new gitrepo API Commit d3348e introduced few errors in Eclipse. This commit cleans up the new API: - fixes API error in RepoCommand after moving IncludedFileReader type - fixes unused imports in RepoCommand & RepoCommandTest - fix javadoc errors in ManifestParser & RepoProject - makes three (implicitly final) fields in ManifestParser final. Change-Id: I4185f451d97039d155391f62815bb9d3afe39fa6 Signed-off-by: Andrey Loskutov --- .../org/eclipse/jgit/gitrepo/RepoCommandTest.java | 2 -- .../src/org/eclipse/jgit/gitrepo/ManifestParser.java | 12 +++++++++--- .../src/org/eclipse/jgit/gitrepo/RepoCommand.java | 3 +-- .../src/org/eclipse/jgit/gitrepo/RepoProject.java | 8 +++++++- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java index 0caf9c6c27..3d86cfd5bb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java @@ -49,8 +49,6 @@ import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; -import java.util.HashSet; -import java.util.Set; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.junit.JGitTestUtil; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java index 2d509381e7..ec9fdfa4e2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java @@ -83,11 +83,12 @@ public class ManifestParser extends DefaultHandler { private final Map remotes; private final Set plusGroups; private final Set minusGroups; - private List projects; - private List filteredProjects; + private final List projects; + private final List filteredProjects; + private final IncludedFileReader includedReader; + private String defaultRemote; private String defaultRevision; - private IncludedFileReader includedReader; private int xmlInRead; private RepoProject currentProject; @@ -154,6 +155,7 @@ public class ManifestParser extends DefaultHandler { * Read the xml file. * * @param inputStream + * @throws IOException */ public void read(InputStream inputStream) throws IOException { xmlInRead++; @@ -295,6 +297,8 @@ public class ManifestParser extends DefaultHandler { /** * Getter for projects. + * + * @return projects list reference, never null */ public List getProjects() { return projects; @@ -302,6 +306,8 @@ public class ManifestParser extends DefaultHandler { /** * Getter for filterdProjects. + * + * @return filtered projects list reference, never null */ public List getFilteredProjects() { return filteredProjects; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index e8a9e18f13..d258250fea 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -46,7 +46,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URI; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -340,7 +339,7 @@ public class RepoCommand extends GitCommand { * * @param reader * @return this command - * @since 3.5 + * @since 4.0 */ public RepoCommand setIncludedFileReader(IncludedFileReader reader) { this.includedReader = reader; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java index c4648abca2..dfd4f1bba8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java @@ -96,6 +96,8 @@ public class RepoProject implements Comparable { /** * Do the copy file action. + * + * @throws IOException */ public void copy() throws IOException { File srcFile = new File(repo.getWorkTree(), @@ -186,7 +188,11 @@ public class RepoProject implements Comparable { } /** - * Check if this sub repo is the ancestor of another sub repo. + * Check if this sub repo is the ancestor of given sub repo. + * + * @param that + * non null + * @return true if this sub repo is the ancestor of given sub repo. */ public boolean isAncestorOf(RepoProject that) { return that.getPathWithSlash().startsWith(this.getPathWithSlash()); -- 2.39.5