Skip to content

Commit

Permalink
Remove redundant type specifiers
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed May 14, 2019
1 parent ad78c42 commit 5b7e8cf
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static void transform(URL url, OutputStream os) throws Exception {

public static Set<String> analyze(Source source) throws Exception {

Set<String> refers = new TreeSet<String>();
Set<String> refers = new TreeSet<>();

ByteArrayOutputStream bout = new ByteArrayOutputStream();
Result r = new StreamResult(bout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@WebSocket
public class WebSocketExample {

private static final Set<Session> sessions = Collections.synchronizedSet(new HashSet<Session>());
private static final Set<Session> sessions = Collections.synchronizedSet(new HashSet<>());

private boolean notification = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void updateConfiguration() {
Configuration configuration = getConfiguration();
Dictionary<String, Object> configurationProperties = configuration.getProperties();
if (configurationProperties == null) {
configurationProperties = new Hashtable<String, Object>();
configurationProperties = new Hashtable<>();
}
configurationProperties.put(CONFIGURATION_KEY, mapToProxyArray(this.proxies));
configuration.update(configurationProperties);
Expand All @@ -131,7 +131,7 @@ private Configuration getConfiguration() {
}

private String[] mapToProxyArray(Map<String, String> proxies) {
List<String> proxyList = new ArrayList<String>();
List<String> proxyList = new ArrayList<>();
for (Map.Entry<String, String> entry : proxies.entrySet()) {
proxyList.add(entry.getKey() + " " + entry.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void setUp() throws Exception {
options.put(BundleContext.class.getName(), context);

expect(context.getServiceReferences(DataSource.class.getName(), null)).andReturn(new ServiceReference[] { reference });
expect((DataSource)context.getService(reference)).andReturn(dataSource);
expect(context.getService(reference)).andReturn(dataSource);
expect(context.ungetService(reference)).andReturn(true);

EasyMock.replay(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public KarServiceImpl(String karafBase, String karStorage, FeaturesService featu
if (!storage.isDirectory()) {
throw new IllegalStateException("KAR storage " + storage + " is not a directory");
}
unsatisfiedKars = Collections.synchronizedList(new ArrayList<Kar>());
unsatisfiedKars = Collections.synchronizedList(new ArrayList<>());
busy = new AtomicBoolean();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public synchronized Iterable<T> getElements() {
public synchronized Iterable<T> getElements(int nb) {
int s = size();
nb = Math.min(Math.max(0, nb), s);
List<T> result = new ArrayList<T>();
List<T> result = new ArrayList<>();
for (int i = 0; i < nb; i++) {
result.add(elements[(i + s - nb + start) % maxElements]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


public interface SystemdDaemon extends Library {
SystemdDaemon INSTANCE = (SystemdDaemon) Native.loadLibrary("systemd-daemon", SystemdDaemon.class);
SystemdDaemon INSTANCE = Native.loadLibrary("systemd-daemon", SystemdDaemon.class);

int sd_notify(int unset_environment, String state);
int sd_notifyf(int unset_environment, String format, Object... args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ protected MavenRepositoryURL[] repositories(Dictionary<String, Object> config, b
if (mavenSettings != null) {
// see org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl.getRepositories()
Set<String> activeProfiles = new LinkedHashSet<>(mavenSettings.getActiveProfiles());
Map<String, Profile> profiles = (Map<String, Profile>)mavenSettings.getProfilesAsMap();
Map<String, Profile> profiles = mavenSettings.getProfilesAsMap();
profiles.values().stream()
.filter((profile) -> profile.getActivation() != null && profile.getActivation().isActiveByDefault())
.map(Profile::getId)
Expand Down Expand Up @@ -591,7 +591,7 @@ protected File nextSequenceFile(File dataDir, Pattern pattern, String fileNameFo
File result = null;
if (files != null && files.length > 0) {
List<String> names = new ArrayList<>(Arrays.stream(files).map(File::getName)
.collect(TreeSet<String>::new, TreeSet::add, TreeSet::addAll));
.collect(TreeSet::new, TreeSet::add, TreeSet::addAll));

names.add(String.format(fileNameFormat, System.currentTimeMillis()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected boolean updateCredentials(boolean force, String id, String username, S
* @return
*/
protected SourceAnd<String> validateRepositoryURL(String uri, boolean defaultRepository) throws URISyntaxException, MalformedURLException {
SourceAnd<String> result = new SourceAnd<String>();
SourceAnd<String> result = new SourceAnd<>();
result.valid = false;

if (uri == null || "".equals(uri.trim())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
"Settings file that contain (or relocates to) master Maven password");

if (showPasswords) {
addRow(table, propertyIds ? "<master>" : "Master password", new SourceAnd<String>(securitySettings.source, masterPassword),
addRow(table, propertyIds ? "<master>" : "Master password", new SourceAnd<>(securitySettings.source, masterPassword),
"Master password used to decrypt proxy and server passwords");
}

Expand All @@ -86,7 +86,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
} else {
updateReleases = "true".equals(updateReleasesProperty);
}
addRow(table, propertyIds ? PROPERTY_UPDATE_RELEASES : "Update releases", new SourceAnd<Boolean>(sourceInfo, updateReleases),
addRow(table, propertyIds ? PROPERTY_UPDATE_RELEASES : "Update releases", new SourceAnd<>(sourceInfo, updateReleases),
"Whether to download non-SNAPSHOT artifacts according to update policy");

// see org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl.isValid()
Expand All @@ -97,7 +97,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
if (requireConfigAdmin) {
sourceInfo = "BundleContext property (" + prefix + REQUIRE_CONFIG_ADMIN_CONFIG + ")";
}
addRow(table, propertyIds ? REQUIRE_CONFIG_ADMIN_CONFIG : "Require Config Admin", new SourceAnd<Boolean>(sourceInfo, requireConfigAdmin),
addRow(table, propertyIds ? REQUIRE_CONFIG_ADMIN_CONFIG : "Require Config Admin", new SourceAnd<>(sourceInfo, requireConfigAdmin),
"Whether MavenResolver service is registered ONLY with proper " + PID + " PID configuration");

// see org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl.buildSettings()
Expand All @@ -107,7 +107,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
if (useFallbackRepositoriesProperty != null) {
sourceInfo = String.format(PATTERN_PID_PROPERTY, PID, prefix + PROPERTY_USE_FALLBACK_REPOSITORIES);
}
addRow(table, propertyIds ? PROPERTY_USE_FALLBACK_REPOSITORIES : "Use fallback repository", new SourceAnd<Boolean>(sourceInfo, useFallbackRepositories),
addRow(table, propertyIds ? PROPERTY_USE_FALLBACK_REPOSITORIES : "Use fallback repository", new SourceAnd<>(sourceInfo, useFallbackRepositories),
"Whether Maven Central is used as implicit, additional remote repository");

// see org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl.enableProxy()
Expand All @@ -120,7 +120,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
if (offlineProperty != null) {
sourceInfo = String.format(PATTERN_PID_PROPERTY, PID, prefix + PROPERTY_OFFLINE);
}
addRow(table, propertyIds ? PROPERTY_OFFLINE : "Offline mode", new SourceAnd<Boolean>(sourceInfo, offline),
addRow(table, propertyIds ? PROPERTY_OFFLINE : "Offline mode", new SourceAnd<>(sourceInfo, offline),
"Disables access to external remote repositories (file:// based ones are still used)");

// see org.ops4j.pax.url.mvn.internal.HttpClients.createConnManager()
Expand All @@ -130,14 +130,14 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
if (certificateCheckProperty != null) {
sourceInfo = String.format(PATTERN_PID_PROPERTY, PID, prefix + PROPERTY_CERTIFICATE_CHECK);
}
addRow(table, propertyIds ? PROPERTY_CERTIFICATE_CHECK : "SSL/TLS certificate check", new SourceAnd<Boolean>(sourceInfo, certificateCheck),
addRow(table, propertyIds ? PROPERTY_CERTIFICATE_CHECK : "SSL/TLS certificate check", new SourceAnd<>(sourceInfo, certificateCheck),
"Turns on server certificate validation for HTTPS remote repositories");

// repositories (short list)
MavenRepositoryURL[] remoteRepositories = repositories(config, true);
boolean first = true;
for (MavenRepositoryURL url : remoteRepositories) {
addRow(table, first ? (propertyIds ? PROPERTY_REPOSITORIES : "Remote repositories") : "", new SourceAnd<String>(url.getFrom().getSource(), url.getURL().toString()),
addRow(table, first ? (propertyIds ? PROPERTY_REPOSITORIES : "Remote repositories") : "", new SourceAnd<>(url.getFrom().getSource(), url.getURL().toString()),
first ? "Remote repositories where artifacts are being resolved if not found locally" : "");
first = false;
}
Expand All @@ -146,7 +146,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
MavenRepositoryURL[] defaultRepositories = repositories(config, false);
first = true;
for (MavenRepositoryURL url : defaultRepositories) {
addRow(table, first ? (propertyIds ? PROPERTY_DEFAULT_REPOSITORIES : "Default repositories") : "", new SourceAnd<String>(url.getFrom().getSource(), url.getURL().toString()),
addRow(table, first ? (propertyIds ? PROPERTY_DEFAULT_REPOSITORIES : "Default repositories") : "", new SourceAnd<>(url.getFrom().getSource(), url.getURL().toString()),
first ? "Repositories where artifacts are looked up before trying remote resolution" : "");
first = false;
}
Expand All @@ -156,7 +156,7 @@ protected void doAction(String prefix, Dictionary<String, Object> config) throws
first = true;
for (Proxy proxy : mavenSettings.getProxies()) {
String value = String.format("%s:%s", proxy.getHost(), proxy.getPort());
addRow(table, first ? (propertyIds ? "<proxies>" : "HTTP proxies") : "", new SourceAnd<String>(MavenRepositoryURL.FROM.SETTINGS.getSource(), value),
addRow(table, first ? (propertyIds ? "<proxies>" : "HTTP proxies") : "", new SourceAnd<>(MavenRepositoryURL.FROM.SETTINGS.getSource(), value),
first ? "Maven HTTP proxies" : "");
first = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void destroy(BundleContext context) {
@Override
public void bundleChanged(final BundleEvent event)
{
final Dictionary<String, Object> properties = new Hashtable<String, Object>();
final Dictionary<String, Object> properties = new Hashtable<>();

properties.put(EventConstants.EVENT, event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public boolean prepare(Action action, CommandSession session, List<Object> param
}

// Populate
Map<Option, Object> optionValues = new HashMap<Option, Object>();
Map<Argument, Object> argumentValues = new HashMap<Argument, Object>();
Map<Option, Object> optionValues = new HashMap<>();
Map<Argument, Object> argumentValues = new HashMap<>();
boolean processOptions = true;
int argIndex = 0;
for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
Expand Down Expand Up @@ -121,7 +121,7 @@ public boolean prepare(Action action, CommandSession session, List<Object> param
@SuppressWarnings("unchecked")
List<Object> l = (List<Object>) optionValues.get(option);
if (l == null) {
l = new ArrayList<Object>();
l = new ArrayList<>();
optionValues.put(option, l);
}
l.add(value);
Expand All @@ -144,7 +144,7 @@ public boolean prepare(Action action, CommandSession session, List<Object> param
@SuppressWarnings("unchecked")
List<Object> l = (List<Object>) argumentValues.get(argument);
if (l == null) {
l = new ArrayList<Object>();
l = new ArrayList<>();
argumentValues.put(argument, l);
}
l.add(param);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public boolean prepare(Action action, Session session, List<Object> params) thro
}

// Populate
Map<Option, Object> optionValues = new HashMap<Option, Object>();
Map<Argument, Object> argumentValues = new HashMap<Argument, Object>();
Map<Option, Object> optionValues = new HashMap<>();
Map<Argument, Object> argumentValues = new HashMap<>();
boolean processOptions = true;
int argIndex = 0;
for (Iterator<Object> it = params.iterator(); it.hasNext(); ) {
Expand Down Expand Up @@ -157,7 +157,7 @@ public boolean prepare(Action action, Session session, List<Object> params) thro
@SuppressWarnings("unchecked")
List<Object> l = (List<Object>) optionValues.get(option);
if (l == null) {
l = new ArrayList<Object>();
l = new ArrayList<>();
optionValues.put(option, l);
}
l.add(value);
Expand All @@ -180,7 +180,7 @@ public boolean prepare(Action action, Session session, List<Object> params) thro
@SuppressWarnings("unchecked")
List<Object> l = (List<Object>) argumentValues.get(argument);
if (l == null) {
l = new ArrayList<Object>();
l = new ArrayList<>();
argumentValues.put(argument, l);
}
l.add(param);
Expand Down Expand Up @@ -310,9 +310,9 @@ private void assertIndexesAreCorrect(Class<? extends Action> actionClass, List<A
public void printUsage(Action action, Map<Option, Field> options, Map<Argument, Field> arguments, PrintStream out, boolean globalScope, int termWidth) {
Command command = action.getClass().getAnnotation(Command.class);
if (command != null) {
List<Argument> argumentsSet = new ArrayList<Argument>(arguments.keySet());
List<Argument> argumentsSet = new ArrayList<>(arguments.keySet());
argumentsSet.sort(Comparator.comparing(Argument::index));
Set<Option> optionsSet = new HashSet<Option>(options.keySet());
Set<Option> optionsSet = new HashSet<>(options.keySet());
optionsSet.add(HelpOption.HELP);
if (command != null && (command.description() != null || command.name() != null)) {
out.println(INTENSITY_BOLD + "DESCRIPTION" + INTENSITY_NORMAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static <T> List<Class<? extends T>> locateAll(Class<T> factoryId) {
public static <T> List<Class<? extends T>> locateAll(Class<T> factoryClass, String factoryId) {
LOCK.readLock().lock();
try {
List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
List<Class<? extends T>> classes = new ArrayList<>();
List<Callable<Class>> l = FACTORIES.get(factoryId);
if (l != null) {
for (Callable<Class> i : l) {
Expand Down

0 comments on commit 5b7e8cf

Please sign in to comment.