Allow inferred types using diamond syntax (flutter/engine#7237)

This commit is contained in:
Todd Volkert
2018-12-17 16:35:10 -08:00
committed by GitHub
parent 2d383262d7
commit cf3c281533
5 changed files with 14 additions and 15 deletions

View File

@@ -171,7 +171,7 @@ public final class FlutterActivityDelegate
String appBundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
if (appBundlePath != null) {
FlutterRunArguments arguments = new FlutterRunArguments();
ArrayList<String> bundlePaths = new ArrayList<String>();
ArrayList<String> 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<String> args = new ArrayList<String>();
ArrayList<String> 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<String> bundlePaths = new ArrayList<String>();
ArrayList<String> bundlePaths = new ArrayList<>();
if (FlutterMain.getUpdateInstallationPath() != null) {
bundlePaths.add(FlutterMain.getUpdateInstallationPath());
}

View File

@@ -51,7 +51,7 @@ class InputConnectionAdaptor extends BaseInputConnection {
selectionStart, selectionEnd,
composingStart, composingEnd);
HashMap<Object, Object> state = new HashMap<Object, Object>();
HashMap<Object, Object> state = new HashMap<>();
state.put("text", mEditable.toString());
state.put("selectionBase", selectionStart);
state.put("selectionExtent", selectionEnd);

View File

@@ -108,8 +108,8 @@ class AccessibilityBridge
AccessibilityBridge(FlutterView owner) {
assert owner != null;
mOwner = owner;
mObjects = new HashMap<Integer, SemanticsObject>();
mCustomAccessibilityActions = new HashMap<Integer, CustomAccessibilityAction>();
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<String, Integer> selection = new HashMap<String, Integer>();
final Map<String, Integer> 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<SemanticsObject> updated = new ArrayList<SemanticsObject>();
ArrayList<SemanticsObject> updated = new ArrayList<>();
while (buffer.hasRemaining()) {
int id = buffer.getInt();
SemanticsObject object = getOrCreateObject(id);
@@ -627,7 +627,7 @@ class AccessibilityBridge
}
}
Set<SemanticsObject> visitedObjects = new HashSet<SemanticsObject>();
Set<SemanticsObject> visitedObjects = new HashSet<>();
SemanticsObject rootObject = getRootObject();
List<SemanticsObject> newRoutes = new ArrayList<>();
if (rootObject != null) {
@@ -1115,7 +1115,7 @@ class AccessibilityBridge
childrenInHitTestOrder = null;
} else {
if (childrenInTraversalOrder == null)
childrenInTraversalOrder = new ArrayList<SemanticsObject>(childCount);
childrenInTraversalOrder = new ArrayList<>(childCount);
else
childrenInTraversalOrder.clear();
@@ -1126,7 +1126,7 @@ class AccessibilityBridge
}
if (childrenInHitTestOrder == null)
childrenInHitTestOrder = new ArrayList<SemanticsObject>(childCount);
childrenInHitTestOrder = new ArrayList<>(childCount);
else
childrenInHitTestOrder.clear();
@@ -1141,8 +1141,7 @@ class AccessibilityBridge
customAccessibilityActions = null;
} else {
if (customAccessibilityActions == null)
customAccessibilityActions =
new ArrayList<CustomAccessibilityAction>(actionCount);
customAccessibilityActions = new ArrayList<>(actionCount);
else
customAccessibilityActions.clear();

View File

@@ -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<String> data = new ArrayList<String>();
List<String> data = new ArrayList<>();
for (int index = 0; index < localeCount; ++index) {
Locale locale = (Locale)localeListGet.invoke(localeList, index);
data.add(locale.getLanguage());

View File

@@ -330,7 +330,7 @@ class ResourceExtractor {
ResourceExtractor(Context context) {
mContext = context;
mResources = new HashSet<String>();
mResources = new HashSet<>();
}
ResourceExtractor addResource(String resource) {