refactor: java 7 migration aid - replace explicit type with <>

This commit is contained in:
エリス 2024-12-05 18:25:32 +09:00
parent ad3aa4b134
commit 63834a362d
No known key found for this signature in database
GPG Key ID: 2E5FF17FB26AF7F2
11 changed files with 16 additions and 16 deletions

View File

@ -97,7 +97,7 @@ public class AllowList {
public static final String TAG = "CordovaAllowList";
public AllowList() {
this.allowList = new ArrayList<URLPattern>();
this.allowList = new ArrayList<>();
}
/* Match patterns (from http://developer.chrome.com/extensions/match_patterns.html)

View File

@ -31,7 +31,7 @@ public class CallbackMap {
private SparseArray<Pair<CordovaPlugin, Integer>> callbacks;
public CallbackMap() {
this.callbacks = new SparseArray<Pair<CordovaPlugin, Integer>>();
this.callbacks = new SparseArray<>();
}
/**
@ -45,7 +45,7 @@ public class CallbackMap {
*/
public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
int mappedId = this.currentCallbackId++;
callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode));
callbacks.put(mappedId, new Pair<>(receiver, requestCode));
return mappedId;
}

View File

@ -39,7 +39,7 @@ public class ConfigXmlParser {
private String launchUrl;
private String contentSrc;
private CordovaPreferences prefs = new CordovaPreferences();
private ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(20);
private ArrayList<PluginEntry> pluginEntries = new ArrayList<>(20);
public CordovaPreferences getPreferences() {
return prefs;

View File

@ -29,7 +29,7 @@ import android.app.Activity;
import android.os.Bundle;
public class CordovaPreferences {
private HashMap<String, String> prefs = new HashMap<String, String>(20);
private HashMap<String, String> prefs = new HashMap<>(20);
private Bundle preferencesBundleExtras;
public void setPreferencesBundle(Bundle extras) {

View File

@ -72,7 +72,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private Set<Integer> boundKeyCodes = new HashSet<Integer>();
private Set<Integer> boundKeyCodes = new HashSet<>();
public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences) {
String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
@ -91,7 +91,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
// Convenience method for when creating programmatically (not from Config.xml).
public void init(CordovaInterface cordova) {
init(cordova, new ArrayList<PluginEntry>(), new CordovaPreferences());
init(cordova, new ArrayList<>(), new CordovaPreferences());
}
@SuppressLint("Assert")

View File

@ -167,7 +167,7 @@ public class CoreAndroid extends CordovaPlugin {
boolean clearHistory = false;
// If there are properties, then set them on the Activity
HashMap<String, Object> params = new HashMap<String, Object>();
HashMap<String, Object> params = new HashMap<>();
if (props != null) {
JSONArray keys = props.names();
for (int i = 0; i < keys.length(); i++) {

View File

@ -51,12 +51,12 @@ public class NativeToJsMessageQueue {
/**
* The list of JavaScript statements to be sent to JavaScript.
*/
private final LinkedList<JsMessage> queue = new LinkedList<JsMessage>();
private final LinkedList<JsMessage> queue = new LinkedList<>();
/**
* The array of listeners that can be used to send messages to JS.
*/
private ArrayList<BridgeMode> bridgeModes = new ArrayList<BridgeMode>();
private ArrayList<BridgeMode> bridgeModes = new ArrayList<>();
/**
* When null, the bridge is disabled. This occurs during page transitions.

View File

@ -52,8 +52,8 @@ public class PluginManager {
private static final int SLOW_EXEC_WARNING_THRESHOLD = Debug.isDebuggerConnected() ? 60 : 16;
// List of service entries
private final Map<String, CordovaPlugin> pluginMap = Collections.synchronizedMap(new LinkedHashMap<String, CordovaPlugin>());
private final Map<String, PluginEntry> entryMap = Collections.synchronizedMap(new LinkedHashMap<String, PluginEntry>());
private final Map<String, CordovaPlugin> pluginMap = Collections.synchronizedMap(new LinkedHashMap<>());
private final Map<String, PluginEntry> entryMap = Collections.synchronizedMap(new LinkedHashMap<>());
private final CordovaInterface ctx;
private final CordovaWebView app;
@ -611,7 +611,7 @@ public class PluginManager {
* @return list of PathHandlers in no particular order
*/
public ArrayList<CordovaPluginPathHandler> getPluginPathHandlers() {
ArrayList<CordovaPluginPathHandler> handlers = new ArrayList<CordovaPluginPathHandler>();
ArrayList<CordovaPluginPathHandler> handlers = new ArrayList<>();
for (CordovaPlugin plugin : this.pluginMap.values()) {
if (plugin != null && plugin.getPathHandler() != null) {
handlers.add(plugin.getPathHandler());

View File

@ -66,7 +66,7 @@ public class ResumeCallback extends CallbackContext {
// the PluginResult passed to this CallbackContext into JSON twice.
// The results are combined into an event payload before the event is
// fired on the js side of things (see platform.js)
List<PluginResult> result = new ArrayList<PluginResult>();
List<PluginResult> result = new ArrayList<>();
result.add(eventResult);
result.add(pluginResult);

View File

@ -274,7 +274,7 @@ public class SystemWebChromeClient extends WebChromeClient {
// Handle result
Uri[] result = null;
if (resultCode == Activity.RESULT_OK) {
List<Uri> uris = new ArrayList<Uri>();
List<Uri> uris = new ArrayList<>();
if (intent != null && intent.getData() != null) { // single file
LOG.v(LOG_TAG, "Adding file (single): " + intent.getData());

View File

@ -68,7 +68,7 @@ public class SystemWebViewClient extends WebViewClient {
boolean isCurrentlyLoading;
/** The authorization tokens. */
private Hashtable<String, AuthenticationToken> authenticationTokens = new Hashtable<String, AuthenticationToken>();
private Hashtable<String, AuthenticationToken> authenticationTokens = new Hashtable<>();
public SystemWebViewClient(SystemWebViewEngine parentEngine) {
this.parentEngine = parentEngine;