未验证 提交 f79f7f63 编写于 作者: T Todd Volkert 提交者: GitHub

Allow inferred types using diamond syntax (#7237)

上级 951edf3e
......@@ -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());
}
......
......@@ -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);
......
......@@ -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();
......
......@@ -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());
......
......@@ -330,7 +330,7 @@ class ResourceExtractor {
ResourceExtractor(Context context) {
mContext = context;
mResources = new HashSet<String>();
mResources = new HashSet<>();
}
ResourceExtractor addResource(String resource) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册