From cf3c281533da7a6c1c76d3c7776156c90b4ae667 Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Mon, 17 Dec 2018 16:35:10 -0800 Subject: [PATCH] Allow inferred types using diamond syntax (flutter/engine#7237) --- .../io/flutter/app/FlutterActivityDelegate.java | 6 +++--- .../plugin/editing/InputConnectionAdaptor.java | 2 +- .../io/flutter/view/AccessibilityBridge.java | 17 ++++++++--------- .../android/io/flutter/view/FlutterView.java | 2 +- .../io/flutter/view/ResourceExtractor.java | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index a78a805797..3e15de0cb6 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -171,7 +171,7 @@ public final class FlutterActivityDelegate String appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext()); if (appBundlePath != null) { FlutterRunArguments arguments = new FlutterRunArguments(); - ArrayList bundlePaths = new ArrayList(); + ArrayList bundlePaths = new ArrayList<>(); if (FlutterMain.getUpdateInstallationPath() != null) { bundlePaths.add(FlutterMain.getUpdateInstallationPath()); } @@ -296,7 +296,7 @@ public final class FlutterActivityDelegate // Before adding more entries to this list, consider that arbitrary // Android applications can generate intents with extra data and that // there are many security-sensitive args in the binary. - ArrayList args = new ArrayList(); + ArrayList args = new ArrayList<>(); if (intent.getBooleanExtra("trace-startup", false)) { args.add("--trace-startup"); } @@ -343,7 +343,7 @@ public final class FlutterActivityDelegate } if (!flutterView.getFlutterNativeView().isApplicationRunning()) { FlutterRunArguments args = new FlutterRunArguments(); - ArrayList bundlePaths = new ArrayList(); + ArrayList bundlePaths = new ArrayList<>(); if (FlutterMain.getUpdateInstallationPath() != null) { bundlePaths.add(FlutterMain.getUpdateInstallationPath()); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index e169d6ff6b..5b2a95d232 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -51,7 +51,7 @@ class InputConnectionAdaptor extends BaseInputConnection { selectionStart, selectionEnd, composingStart, composingEnd); - HashMap state = new HashMap(); + HashMap state = new HashMap<>(); state.put("text", mEditable.toString()); state.put("selectionBase", selectionStart); state.put("selectionExtent", selectionEnd); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java index dfa9662f2a..712b95761e 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -108,8 +108,8 @@ class AccessibilityBridge AccessibilityBridge(FlutterView owner) { assert owner != null; mOwner = owner; - mObjects = new HashMap(); - mCustomAccessibilityActions = new HashMap(); + mObjects = new HashMap<>(); + mCustomAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); mFlutterAccessibilityChannel = new BasicMessageChannel<>( owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); @@ -443,7 +443,7 @@ class AccessibilityBridge return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { - final Map selection = new HashMap(); + final Map selection = new HashMap<>(); final boolean hasSelection = arguments != null && arguments.containsKey( AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT) @@ -611,7 +611,7 @@ class AccessibilityBridge } void updateSemantics(ByteBuffer buffer, String[] strings) { - ArrayList updated = new ArrayList(); + ArrayList updated = new ArrayList<>(); while (buffer.hasRemaining()) { int id = buffer.getInt(); SemanticsObject object = getOrCreateObject(id); @@ -627,7 +627,7 @@ class AccessibilityBridge } } - Set visitedObjects = new HashSet(); + Set visitedObjects = new HashSet<>(); SemanticsObject rootObject = getRootObject(); List newRoutes = new ArrayList<>(); if (rootObject != null) { @@ -1115,7 +1115,7 @@ class AccessibilityBridge childrenInHitTestOrder = null; } else { if (childrenInTraversalOrder == null) - childrenInTraversalOrder = new ArrayList(childCount); + childrenInTraversalOrder = new ArrayList<>(childCount); else childrenInTraversalOrder.clear(); @@ -1126,7 +1126,7 @@ class AccessibilityBridge } if (childrenInHitTestOrder == null) - childrenInHitTestOrder = new ArrayList(childCount); + childrenInHitTestOrder = new ArrayList<>(childCount); else childrenInHitTestOrder.clear(); @@ -1141,8 +1141,7 @@ class AccessibilityBridge customAccessibilityActions = null; } else { if (customAccessibilityActions == null) - customAccessibilityActions = - new ArrayList(actionCount); + customAccessibilityActions = new ArrayList<>(actionCount); else customAccessibilityActions.clear(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index a8fb3ff483..82799421a9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -319,7 +319,7 @@ public class FlutterView extends SurfaceView Method localeListGet = localeList.getClass().getDeclaredMethod("get", int.class); Method localeListSize = localeList.getClass().getDeclaredMethod("size"); int localeCount = (int)localeListSize.invoke(localeList); - List data = new ArrayList(); + List data = new ArrayList<>(); for (int index = 0; index < localeCount; ++index) { Locale locale = (Locale)localeListGet.invoke(localeList, index); data.add(locale.getLanguage()); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java b/engine/src/flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java index fd7d148be9..25b98bdb42 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -330,7 +330,7 @@ class ResourceExtractor { ResourceExtractor(Context context) { mContext = context; - mResources = new HashSet(); + mResources = new HashSet<>(); } ResourceExtractor addResource(String resource) {