@@ -214,18 +214,43 @@ public String getRepoOwner() {
214214 @ Override
215215 @ NonNull
216216 public List <SCMTrait <? extends SCMTrait <?>>> getTraits () {
217- return Collections .< SCMTrait <? extends SCMTrait <?>>> unmodifiableList (traits );
217+ return Collections .unmodifiableList (traits );
218218 }
219219
220220 @ DataBoundSetter
221221 public void setCredentialsId (@ CheckForNull String credentialsId ) {
222222 this .credentialsId = Util .fixEmpty (credentialsId );
223223 }
224224
225+ /**
226+ * Sets the behavioural traits that are applied to this navigator and any {@link BitbucketSCMSource} instances it
227+ * discovers. The new traits will take affect on the next navigation through any of the
228+ * {@link #visitSources(SCMSourceObserver)} overloads or {@link #visitSource(String, SCMSourceObserver)}.
229+ *
230+ * @param traits the new behavioural traits.
231+ */
232+ @ SuppressWarnings ({"unchecked" , "rawtypes" })
225233 @ DataBoundSetter
226- public void setTraits (@ CheckForNull List < SCMTrait <? extends SCMTrait <?>>> traits ) {
234+ public void setTraits (@ CheckForNull SCMTrait [] traits ) {
227235 // the reduced generics in the method signature are a workaround for JENKINS-26535
228- this .traits = new ArrayList <>(Util .fixNull (traits ));
236+ this .traits = new ArrayList <>();
237+ if (traits != null ) {
238+ for (SCMTrait trait : traits ) {
239+ this .traits .add (trait );
240+ }
241+ }
242+ }
243+
244+ /**
245+ * Sets the behavioural traits that are applied to this navigator and any {@link BitbucketSCMSource} instances it
246+ * discovers. The new traits will take affect on the next navigation through any of the
247+ * {@link #visitSources(SCMSourceObserver)} overloads or {@link #visitSource(String, SCMSourceObserver)}.
248+ *
249+ * @param traits the new behavioural traits.
250+ */
251+ @ Override
252+ public void setTraits (@ CheckForNull List <SCMTrait <? extends SCMTrait <?>>> traits ) {
253+ this .traits = traits != null ? new ArrayList <>(traits ) : new ArrayList <SCMTrait <? extends SCMTrait <?>>>();
229254 }
230255
231256 public String getServerUrl () {
@@ -642,8 +667,9 @@ public List<NamedArrayList<? extends SCMTraitDescriptor<?>>> getTraitsDescriptor
642667 }
643668
644669 @ Override
670+ @ NonNull
645671 public List <SCMTrait <? extends SCMTrait <?>>> getTraitsDefaults () {
646- return Arrays .< SCMTrait <? extends SCMTrait <?>>> asList (
672+ return Arrays .asList (
647673 new BranchDiscoveryTrait (true , false ),
648674 new OriginPullRequestDiscoveryTrait (EnumSet .of (ChangeRequestCheckoutStrategy .MERGE )),
649675 new ForkPullRequestDiscoveryTrait (EnumSet .of (ChangeRequestCheckoutStrategy .MERGE ),
0 commit comments