Skip to content

Commit

Permalink
Remove unneccesary new Builder2 class
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKosicky committed Aug 1, 2022
1 parent b7498d1 commit d2e67ee
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/main/java/jenkins/scm/api/SCMFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,7 @@ public static SCMFileSystem of(@NonNull Item owner, @NonNull SCM scm,
for (Builder b : ExtensionList.lookup(Builder.class)) {
if (b.supports(scm)) {
try {
SCMFileSystem inspector;
if (b instanceof Builder2)
{
inspector = ((Builder2)b).build(owner,scm,rev, build);
} else
{
inspector = b.build(owner, scm, rev);
}
SCMFileSystem inspector = b.build(owner, scm, rev, build);

if (inspector != null) {
if (inspector.isFixedRevision()) {
Expand Down Expand Up @@ -555,9 +548,6 @@ public SCMFileSystem build(@NonNull SCMSource source, @NonNull SCMHead head,
}
return build(owner, source.build(head, rev), rev);
}
}

public abstract static class Builder2 extends Builder {

/**
* Given a {@link SCM} this should try to build a corresponding {@link SCMFileSystem} instance that
Expand All @@ -569,16 +559,21 @@ public abstract static class Builder2 extends Builder {
* @param owner the owner of the {@link SCM}
* @param scm the {@link SCM}.
* @param rev the specified {@link SCMRevision}.
* @param build the specified {@link Run}.
* @param _build the specified {@link Run}.
* @return the corresponding {@link SCMFileSystem} or {@code null} if this builder cannot create a {@link
* SCMFileSystem} for the specified {@link SCM}.
* @throws IOException if the attempt to create a {@link SCMFileSystem} failed due to an IO error
* (such as the remote system being unavailable)
* @throws InterruptedException if the attempt to create a {@link SCMFileSystem} was interrupted.
*/
@CheckForNull
public abstract SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull SCMRevision rev,
@CheckForNull Run<?,?> build)
throws IOException, InterruptedException;
public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull SCMRevision rev,
@CheckForNull Run<?,?> _build)
throws IOException, InterruptedException
{
// if this is not overriden, fallback to the previous implementation
return build(owner,scm, rev);
}
}

}

0 comments on commit d2e67ee

Please sign in to comment.