Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some code modernization for Java 8 and recent Jenkins #148

Merged
merged 10 commits into from
Apr 21, 2020

Conversation

jvz
Copy link
Member

@jvz jvz commented Apr 20, 2020

This updates code to use currently supported language features.

Signed-off-by: Matt Sicker [email protected]

This updates code to use currently supported language features.

Signed-off-by: Matt Sicker <[email protected]>
@jvz jvz added the internal Internal changes not too interesting for users label Apr 20, 2020
iterator.remove();
}
}
resolverByName.values().removeIf(r -> r == ContextResolver.NONE);
Copy link
Member

Choose a reason for hiding this comment

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

or stream

iterator.remove();
}
}
providerByName.values().removeIf(p -> p == CredentialsProvider.NONE);
Copy link
Member

Choose a reason for hiding this comment

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

or stream

iterator.remove();
}
}
requirements.removeIf(r -> r instanceof HostnamePortRequirement);
Copy link
Member

Choose a reason for hiding this comment

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

(Reviewer note: these cases are deliberately mutating, it seems.)

@@ -285,7 +285,7 @@ public void testNodeCredentialFingerprintsAreRemovedForNonExistentNodes() throws
DumbSlave addedSlave = new DumbSlave("added-slave",
"dummy", "/home/test/slave", "1", Node.Mode.NORMAL, "remote",
new JNLPLauncher(),
RetentionStrategy.INSTANCE, Collections.<NodeProperty<?>>emptyList());
RetentionStrategy.INSTANCE, Collections.emptyList());
Copy link
Member

Choose a reason for hiding this comment

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

FYI, this constructor is deprecated and you can more easily use a simpler version.

jvz added 4 commits April 20, 2020 17:53
Signed-off-by: Matt Sicker <[email protected]>
Signed-off-by: Matt Sicker <[email protected]>
Signed-off-by: Matt Sicker <[email protected]>
@jvz jvz changed the title Apply automated Java 8 refactoring Apply some code modernization for Java 8 and recent Jenkins Apr 20, 2020
jvz added 4 commits April 20, 2020 20:12
Signed-off-by: Matt Sicker <[email protected]>
Signed-off-by: Matt Sicker <[email protected]>
Signed-off-by: Matt Sicker <[email protected]>
@jvz jvz requested review from res0nance and Wadeck April 21, 2020 14:24
@@ -178,7 +178,7 @@ public CredentialsStore getStore(@CheckForNull ModelObject object) {
}
}
}
return new ArrayList<C>();
return new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return new ArrayList<>();
return Collections.emptyList();

@jvz
Copy link
Member Author

jvz commented Apr 21, 2020

GitHub outage caused build failure. Closing to retry.

@jvz jvz closed this Apr 21, 2020
@jvz jvz reopened this Apr 21, 2020
@jvz jvz merged commit 0d65c84 into jenkinsci:master Apr 21, 2020
@jvz jvz deleted the java8 branch April 21, 2020 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Internal changes not too interesting for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants