Skip to content

Commit

Permalink
Allow inferred types using diamond syntax (flutter#7237)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvolkert authored Dec 18, 2018
1 parent 951edf3 commit f79f7f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void onCreate(Bundle savedInstanceState) {
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());
}
Expand Down Expand Up @@ -296,7 +296,7 @@ private static String[] getArgsFromIntent(Intent intent) {
// 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");
}
Expand Down Expand Up @@ -343,7 +343,7 @@ private boolean loadIntent(Intent intent) {
}
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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void updateEditingState() {
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);
Expand Down
17 changes: 8 additions & 9 deletions shell/platform/android/io/flutter/view/AccessibilityBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ enum Flag {
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);
Expand Down Expand Up @@ -443,7 +443,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) {
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)
Expand Down Expand Up @@ -611,7 +611,7 @@ void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) {
}

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);
Expand All @@ -627,7 +627,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) {
}
}

Set<SemanticsObject> visitedObjects = new HashSet<SemanticsObject>();
Set<SemanticsObject> visitedObjects = new HashSet<>();
SemanticsObject rootObject = getRootObject();
List<SemanticsObject> newRoutes = new ArrayList<>();
if (rootObject != null) {
Expand Down Expand Up @@ -1115,7 +1115,7 @@ void updateWith(ByteBuffer buffer, String[] strings) {
childrenInHitTestOrder = null;
} else {
if (childrenInTraversalOrder == null)
childrenInTraversalOrder = new ArrayList<SemanticsObject>(childCount);
childrenInTraversalOrder = new ArrayList<>(childCount);
else
childrenInTraversalOrder.clear();

Expand All @@ -1126,7 +1126,7 @@ void updateWith(ByteBuffer buffer, String[] strings) {
}

if (childrenInHitTestOrder == null)
childrenInHitTestOrder = new ArrayList<SemanticsObject>(childCount);
childrenInHitTestOrder = new ArrayList<>(childCount);
else
childrenInHitTestOrder.clear();

Expand All @@ -1141,8 +1141,7 @@ void updateWith(ByteBuffer buffer, String[] strings) {
customAccessibilityActions = null;
} else {
if (customAccessibilityActions == null)
customAccessibilityActions =
new ArrayList<CustomAccessibilityAction>(actionCount);
customAccessibilityActions = new ArrayList<>(actionCount);
else
customAccessibilityActions.clear();

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private void setLocales(Configuration config) {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ protected Void doInBackground(Void... unused) {

ResourceExtractor(Context context) {
mContext = context;
mResources = new HashSet<String>();
mResources = new HashSet<>();
}

ResourceExtractor addResource(String resource) {
Expand Down

0 comments on commit f79f7f6

Please sign in to comment.