Skip to content

Commit cabd3fd

Browse files
committed
use pattern matching in decorateContext
1 parent d609e92 commit cabd3fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/jenkins/plugins/git/traits/CloneOptionTrait.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ public CloneOptionTrait(CloneOption extension) {
5151

5252
@Override
5353
protected void decorateContext(SCMSourceContext<?, ?> context) {
54-
CloneOption extension = getExtension();
55-
((GitSCMSourceContext<?, ?>) context).shallow(extension.isShallow()).depth(extension.getDepth());
54+
if (context instanceof GitSCMSourceContext gitContext) {
55+
CloneOption extension = getExtension();
56+
gitContext.shallow(extension.isShallow()).depth(extension.getDepth());
57+
}
5658
}
5759

5860
/**

0 commit comments

Comments
 (0)