Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant code #636

Merged
merged 2 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/git/GitTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public static GitTool getDefaultInstallation() {
}

public GitTool forNode(Node node, TaskListener log) throws IOException, InterruptedException {
return new GitTool(getName(), translateFor(node, log), Collections.<ToolProperty<?>>emptyList());
return new GitTool(getName(), translateFor(node, log), Collections.emptyList());
}

public GitTool forEnvironment(EnvVars environment) {
return new GitTool(getName(), environment.expand(getHome()), Collections.<ToolProperty<?>>emptyList());
return new GitTool(getName(), environment.expand(getHome()), Collections.emptyList());
}

@Override
Expand All @@ -126,7 +126,7 @@ public static void onLoaded() {
}

String defaultGitExe = isWindows() ? "git.exe" : "git";
GitTool tool = new GitTool(DEFAULT, defaultGitExe, Collections.<ToolProperty<?>>emptyList());
GitTool tool = new GitTool(DEFAULT, defaultGitExe, Collections.emptyList());
descriptor.setInstallations(new GitTool[] { tool });
descriptor.save();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/git/IGitAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public interface IGitAPI extends GitClient {
* @throws hudson.plugins.git.GitException if underlying git operation fails.
* @throws java.lang.InterruptedException if interrupted.
*/
public void fetch(String repository, String refspec) throws GitException, InterruptedException;
void fetch(String repository, String refspec) throws GitException, InterruptedException;

/**
* Retrieve commits from RemoteConfig.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2680,7 +2680,7 @@ public CheckoutCommand deleteBranchIfExist(boolean deleteBranch) {

@Override
public CheckoutCommand sparseCheckoutPaths(List<String> sparseCheckoutPaths) {
this.sparseCheckoutPaths = sparseCheckoutPaths == null ? Collections.<String>emptyList() : sparseCheckoutPaths;
this.sparseCheckoutPaths = sparseCheckoutPaths == null ? Collections.emptyList() : sparseCheckoutPaths;
return this;
}

Expand Down Expand Up @@ -3584,7 +3584,7 @@ Output shows SHA1 and tag with (optional) marker for annotated tags
*/
String[] output = result.split("[\\n\\r]+");
if (output.length == 0 || (output.length == 1 && output[0].isEmpty())) {
return Collections.<GitObject>emptySet();
return Collections.emptySet();
}
Pattern pattern = Pattern.compile("(\\p{XDigit}{40})\\s+refs/tags/([^^]+)(\\^\\{\\})?");
Map<String, ObjectId> tagMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public interface GitClient {
* @throws hudson.plugins.git.GitException if underlying git operation fails.
* @throws java.lang.InterruptedException if interrupted.
*/
public void init() throws GitException, InterruptedException;
void init() throws GitException, InterruptedException;

/**
* add.
Expand Down Expand Up @@ -897,7 +897,7 @@ public interface GitClient {
* @throws hudson.plugins.git.GitException if underlying git operation fails.
* @throws java.lang.InterruptedException if interrupted.
*/
public List<String> showRevision(ObjectId r) throws GitException, InterruptedException;
List<String> showRevision(ObjectId r) throws GitException, InterruptedException;

/**
* Given a Revision, show it as if it were an entry from git whatchanged, so that it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private GitURIRequirementsBuilder(@NonNull List<DomainRequirement> requirements)
*/
@NonNull
public static GitURIRequirementsBuilder create() {
return new GitURIRequirementsBuilder(Collections.<DomainRequirement>emptyList());
return new GitURIRequirementsBuilder(Collections.emptyList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public CheckoutCommand deleteBranchIfExist(boolean deleteBranch) {

@Override
public CheckoutCommand sparseCheckoutPaths(List<String> sparseCheckoutPaths) {
this.sparseCheckoutPaths = sparseCheckoutPaths == null ? Collections.<String>emptyList() : sparseCheckoutPaths;
this.sparseCheckoutPaths = sparseCheckoutPaths == null ? Collections.emptyList() : sparseCheckoutPaths;
return this;
}

Expand Down Expand Up @@ -2442,7 +2442,7 @@ public String getAllLogEntries(String branch) throws InterruptedException {
* Adds all the refs as start commits.
*/
private void markAllRefs(RevWalk walk) throws IOException {
markRefs(walk, Predicates.<Ref>alwaysTrue());
markRefs(walk, Predicates.alwaysTrue());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public JGitApacheTool(final List<? extends ToolProperty<?>> properties) {
}

public JGitApacheTool() {
this(Collections.<ToolProperty<?>>emptyList());
this(Collections.emptyList());
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public JGitTool(List<? extends ToolProperty<?>> properties) {
* Constructor for JGitTool.
*/
public JGitTool() {
this(Collections.<ToolProperty<?>>emptyList());
this(Collections.emptyList());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface MergeCommand extends GitCommand {
*/
MergeCommand setStrategy(Strategy strategy);

public enum Strategy {
enum Strategy {
DEFAULT, RESOLVE, RECURSIVE, OCTOPUS, OURS, SUBTREE, RECURSIVE_THEIRS;

@Override
Expand All @@ -53,7 +53,7 @@ public String toString() {
*/
MergeCommand setGitPluginFastForwardMode(GitPluginFastForwardMode fastForwardMode);

public enum GitPluginFastForwardMode {
enum GitPluginFastForwardMode {
FF, // Default option, fast forward update the branch pointer only
FF_ONLY, // Create a merge commit even for a fast forward
NO_FF; // Abort unless the merge is a fast forward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class UnsupportedCommand {
* @return this for chaining
*/
public UnsupportedCommand sparseCheckoutPaths(List<String> sparseCheckoutPaths) {
List<String> sparseList = sparseCheckoutPaths == null ? Collections.<String>emptyList() : sparseCheckoutPaths;
List<String> sparseList = sparseCheckoutPaths == null ? Collections.emptyList() : sparseCheckoutPaths;
if (!sparseList.isEmpty()) {
useJGit = false;
}
Expand Down