Skip to content

Commit

Permalink
Merge pull request #759 from jglick/ExtensionList.lookupSingleton
Browse files Browse the repository at this point in the history
Gratuitous use of Guice
  • Loading branch information
jtnord authored Jan 18, 2024
2 parents a69edad + a223cd1 commit 2e745a0
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.AbortException;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.RestrictedSince;
import hudson.Util;
import hudson.console.HyperlinkNote;
Expand All @@ -48,7 +49,6 @@
import hudson.model.TaskListener;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import jakarta.inject.Inject;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -1716,9 +1716,6 @@ public static class DescriptorImpl extends SCMNavigatorDescriptor implements Ico
@RestrictedSince("2.2.0")
public static final boolean defaultBuildForkPRHead = false;

@Inject
private GitHubSCMSource.DescriptorImpl delegate;

/** {@inheritDoc} */
@Override
public String getPronoun() {
Expand Down Expand Up @@ -1894,7 +1891,8 @@ public boolean test(SCMTraitDescriptor<?> scmTraitDescriptor) {
@SuppressWarnings("unused") // jelly
@NonNull
public List<SCMTrait<? extends SCMTrait<?>>> getTraitsDefaults() {
return new ArrayList<>(delegate.getTraitsDefaults());
return new ArrayList<>(ExtensionList.lookupSingleton(GitHubSCMSource.DescriptorImpl.class)
.getTraitsDefaults());

Check warning on line 1895 in src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 1894-1895 are not covered by tests
}

static {
Expand Down

1 comment on commit 2e745a0

@neerajdkd1299
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Please sign in to comment.