Skip to content

Commit

Permalink
Use Java 17 language features (jenkinsci#129)
Browse files Browse the repository at this point in the history
instanceof pattern matching
  • Loading branch information
MarkEWaite authored Oct 22, 2024
1 parent 2f7e372 commit 74d33fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ public boolean isAutomaticBuild(
return false;
}
if (ignoreTargetOnlyChanges
&& currRevision instanceof ChangeRequestSCMRevision
&& lastBuiltRevision instanceof ChangeRequestSCMRevision) {
ChangeRequestSCMRevision<?> curr = (ChangeRequestSCMRevision<?>) currRevision;
if (curr.isMerge() && curr.equivalent((ChangeRequestSCMRevision<?>) lastBuiltRevision)) {
&& currRevision instanceof ChangeRequestSCMRevision<?> curr
&& lastBuiltRevision instanceof ChangeRequestSCMRevision<?> revision) {
if (curr.isMerge() && curr.equivalent(revision)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public FreeStyleProject setBranch(FreeStyleProject project, Branch branch) {

@Override
public boolean isProject(Item item) {
return item instanceof FreeStyleProject
&& ((FreeStyleProject) item).getProperty(BasicBranchProperty.class) != null;
return item instanceof FreeStyleProject fsp && fsp.getProperty(BasicBranchProperty.class) != null;
}

@Extension
Expand Down

0 comments on commit 74d33fa

Please sign in to comment.