Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0ed0db7 authored by Max Loh's avatar Max Loh
Browse files

ASL change toList to collect(Collectors.toList()) for compatibility with...

ASL change toList to collect(Collectors.toList()) for compatibility with Google3 which uses and older JDK version.

Bug: b/329902686
Test: Unit tests
Flag: NONE (Command-line tool which doesn't affect Android functionality)
Change-Id: I84ce58aef86136b36f91ddc4687cc7e475a9a1f5
parent 9962f020
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import org.w3c.dom.Element;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Data label representation with data shared and data collected maps containing zero or more {@link
@@ -138,7 +139,7 @@ public class DataLabels implements AslMarshallable {
                                "|",
                                dataType.getPurposes().stream()
                                        .map(DataType.Purpose::toString)
                                        .toList()));
                                        .collect(Collectors.toList())));
                dataLabelsEle.appendChild(hrDataTypeEle);
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Data usage type representation. Types are specific to a {@link DataCategory} and contains
@@ -182,7 +183,7 @@ public class DataType implements AslMarshallable {
                            XmlUtils.OD_NAME_PURPOSES,
                            this.getPurposes().stream()
                                    .map(p -> String.valueOf(p.getValue()))
                                    .toList()));
                                    .collect(Collectors.toList())));
        }

        maybeAddBoolToOdElement(
+12 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import org.w3c.dom.NodeList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class XmlUtils {
    public static final String DATA_TYPE_SEPARATOR = "_data_type_";
@@ -131,7 +132,9 @@ public class XmlUtils {
    /** Gets the top-level children with the tag name.. */
    public static List<Element> getChildrenByTagName(Node parentEle, String tagName) {
        var elements = XmlUtils.asElementList(parentEle.getChildNodes());
        return elements.stream().filter(e -> e.getTagName().equals(tagName)).toList();
        return elements.stream()
                .filter(e -> e.getTagName().equals(tagName))
                .collect(Collectors.toList());
    }

    /**
@@ -286,7 +289,8 @@ public class XmlUtils {
    /** Gets a pipeline-split attribute. */
    public static List<String> getPipelineSplitAttr(Element ele, String attrName, boolean required)
            throws MalformedXmlException {
        List<String> list = Arrays.stream(ele.getAttribute(attrName).split("\\|")).toList();
        List<String> list =
                Arrays.stream(ele.getAttribute(attrName).split("\\|")).collect(Collectors.toList());
        if ((list.isEmpty() || list.get(0).isEmpty()) && required) {
            throw new MalformedXmlException(
                    String.format(
@@ -315,7 +319,7 @@ public class XmlUtils {
        List<Element> boolEles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_BOOLEAN).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (boolEles.size() > 1) {
            throw new MalformedXmlException(
                    String.format(
@@ -346,7 +350,7 @@ public class XmlUtils {
        List<Element> longEles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_LONG).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (longEles.size() > 1) {
            throw new MalformedXmlException(
                    String.format(
@@ -377,7 +381,7 @@ public class XmlUtils {
        List<Element> eles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_STRING).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (eles.size() > 1) {
            throw new MalformedXmlException(
                    String.format(
@@ -405,7 +409,7 @@ public class XmlUtils {
        List<Element> eles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_PBUNDLE_AS_MAP).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (eles.size() > 1) {
            throw new MalformedXmlException(
                    String.format(
@@ -449,7 +453,7 @@ public class XmlUtils {
        List<Element> intArrayEles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_INT_ARRAY).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (intArrayEles.size() > 1) {
            throw new MalformedXmlException(
                    String.format("Found more than one %s in %s.", nameName, ele.getTagName()));
@@ -502,7 +506,7 @@ public class XmlUtils {
        List<Element> arrayEles =
                XmlUtils.getChildrenByTagName(ele, XmlUtils.OD_TAG_STRING_ARRAY).stream()
                        .filter(e -> e.getAttribute(XmlUtils.OD_ATTR_NAME).equals(nameName))
                        .toList();
                        .collect(Collectors.toList());
        if (arrayEles.size() > 1) {
            throw new MalformedXmlException(
                    String.format(