Skip to content

Commit

Permalink
Remove redundant casts
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 17, 2024
1 parent 972af6e commit 0f3662f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/EC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ private static AmazonWebServicesCredentials getCredentials(@CheckForNull String
if (StringUtils.isBlank(credentialsId)) {
return null;
}
return (AmazonWebServicesCredentials) CredentialsMatchers.firstOrNull(
return CredentialsMatchers.firstOrNull(
CredentialsProvider.lookupCredentials(
AmazonWebServicesCredentials.class, Jenkins.get(), ACL.SYSTEM, Collections.emptyList()),
CredentialsMatchers.withId(credentialsId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MinimumInstanceChecker {
public static Clock clock = Clock.systemDefaultZone();

private static Stream<Computer> agentsForTemplate(@NonNull SlaveTemplate agentTemplate) {
return (Stream<Computer>) Arrays.stream(Jenkins.get().getComputers())
return Arrays.stream(Jenkins.get().getComputers())
.filter(EC2Computer.class::isInstance)
.filter(computer -> {
SlaveTemplate computerTemplate = ((EC2Computer) computer).getSlaveTemplate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void testOnBillingHourRetention() throws Exception {
checkRetentionStrategy(rs, computer);
assertEquals(
"Expected " + t[0] + "m" + t[1] + "s to be " + expected.get(i),
(boolean) expected.get(i),
expected.get(i),
idleTimeoutCalled.get());
// reset the assumption
idleTimeoutCalled.set(false);
Expand Down Expand Up @@ -474,13 +474,13 @@ public void testOnUsageCountRetention() throws Exception {
}
// As we want to terminate agent both for usageCount 1 & 0 - setting this to true
if (usageCount == 1 || usageCount == 0) {
assertEquals("Expected " + usageCount + " to be " + true, (boolean) true, terminateCalled.get());
assertEquals("Expected " + usageCount + " to be " + true, true, terminateCalled.get());
// Reset the assumption
terminateCalled.set(false);
} else {
assertEquals(
"Expected " + usageCount + " to be " + expected.get(i),
(boolean) expected.get(i),
expected.get(i),
terminateCalled.get());
}
}
Expand Down

0 comments on commit 0f3662f

Please sign in to comment.