proguard.util.ListUtil Java Examples

The following examples show how to use proguard.util.ListUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationWriter.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private boolean writeFilter(boolean filtered, List filter)
{
    if (filtered)
    {
        writer.print(ConfigurationConstants.SEPARATOR_KEYWORD);
    }

    if (filter != null)
    {
        if (!filtered)
        {
            writer.print(ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD);
        }

        writer.print(ListUtil.commaSeparatedString(filter, true));

        filtered = true;
    }

    return filtered;
}
 
Example #2
Source File: ClassPathEntry.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public String toString()
{
    String string = getName();

    if (filter    != null ||
        jarFilter != null ||
        warFilter != null ||
        earFilter != null ||
        zipFilter != null)
    {
        string +=
            ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD +
            (zipFilter != null ? ListUtil.commaSeparatedString(zipFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (earFilter != null ? ListUtil.commaSeparatedString(earFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (warFilter != null ? ListUtil.commaSeparatedString(warFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (jarFilter != null ? ListUtil.commaSeparatedString(jarFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (filter    != null ? ListUtil.commaSeparatedString(filter, true)    : "")  +
            ConfigurationConstants.CLOSE_ARGUMENTS_KEYWORD;
    }

    return string;
}
 
Example #3
Source File: ConfigurationWriter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private boolean writeFilter(boolean filtered, List filter)
{
    if (filtered)
    {
        writer.print(ConfigurationConstants.SEPARATOR_KEYWORD);
    }

    if (filter != null)
    {
        if (!filtered)
        {
            writer.print(ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD);
        }

        writer.print(ListUtil.commaSeparatedString(filter, true));

        filtered = true;
    }

    return filtered;
}
 
Example #4
Source File: ConfigurationWriter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private void writeOption(String  optionName,
                         List    arguments,
                         boolean replaceInternalClassNames)
{
    if (arguments != null)
    {
        if (arguments.isEmpty())
        {
            writer.println(optionName);
        }
        else
        {
            if (replaceInternalClassNames)
            {
                arguments = externalClassNames(arguments);
            }

            writer.print(optionName);
            writer.print(' ');
            writer.println(ListUtil.commaSeparatedString(arguments, true));
        }
    }
}
 
Example #5
Source File: ClassPathPanel.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private StringBuffer appendFilter(StringBuffer filter, List additionalFilter)
{
    if (filter != null)
    {
        filter.append(';');
    }

    if (additionalFilter != null)
    {
        if (filter == null)
        {
            filter = new StringBuffer().append('(');
        }

        filter.append(ListUtil.commaSeparatedString(additionalFilter, true));
    }

    return filter;
}
 
Example #6
Source File: ConfigurationWriter.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private void writeOption(String  optionName,
                         List    arguments,
                         boolean replaceInternalClassNames)
{
    if (arguments != null)
    {
        if (arguments.isEmpty())
        {
            writer.println(optionName);
        }
        else
        {
            if (replaceInternalClassNames)
            {
                arguments = externalClassNames(arguments);
            }

            writer.print(optionName);
            writer.print(' ');
            writer.println(ListUtil.commaSeparatedString(arguments, true));
        }
    }
}
 
Example #7
Source File: ConfigurationWriter.java    From bazel with Apache License 2.0 6 votes vote down vote up
private void writeOption(String  optionName,
                         List    arguments,
                         boolean replaceInternalClassNames)
{
    if (arguments != null)
    {
        if (arguments.isEmpty())
        {
            writer.println(optionName);
        }
        else
        {
            if (replaceInternalClassNames)
            {
                arguments = externalClassNames(arguments);
            }

            writer.print(optionName);
            writer.print(' ');
            writer.println(ListUtil.commaSeparatedString(arguments, true));
        }
    }
}
 
Example #8
Source File: ClassPathPanel.java    From bazel with Apache License 2.0 6 votes vote down vote up
private StringBuffer appendFilter(StringBuffer filter, List additionalFilter)
{
    if (filter != null)
    {
        filter.append(';');
    }

    if (additionalFilter != null)
    {
        if (filter == null)
        {
            filter = new StringBuffer().append('(');
        }

        filter.append(ListUtil.commaSeparatedString(additionalFilter, true));
    }

    return filter;
}
 
Example #9
Source File: ConfigurationWriter.java    From bazel with Apache License 2.0 6 votes vote down vote up
private boolean writeFilter(boolean filtered, List filter)
{
    if (filtered)
    {
        writer.print(ConfigurationConstants.SEPARATOR_KEYWORD);
    }

    if (filter != null)
    {
        if (!filtered)
        {
            writer.print(ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD);
        }

        writer.print(ListUtil.commaSeparatedString(filter, true));

        filtered = true;
    }

    return filtered;
}
 
Example #10
Source File: FilterDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the zip filter currently represented in this dialog.
 */
public List getZipFilter()
{
    String filter = zipFilterTextField.getText();

    return filter.equals(DEFAULT_ZIP_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #11
Source File: ClassPathEntry.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public String toString()
{
    String string = getName();

    if (filter     != null ||
        apkFilter  != null ||
        aabFilter  != null ||
        jarFilter  != null ||
        aarFilter  != null ||
        warFilter  != null ||
        earFilter  != null ||
        jmodFilter != null ||
        zipFilter  != null)
    {
        string +=
            ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD +
            (aarFilter  != null ? ListUtil.commaSeparatedString(aarFilter,  true) : "")  +
             ConfigurationConstants.SEPARATOR_KEYWORD +
            (aabFilter  != null ? ListUtil.commaSeparatedString(aabFilter,  true) : "")  +
             ConfigurationConstants.SEPARATOR_KEYWORD +
            (apkFilter  != null ? ListUtil.commaSeparatedString(apkFilter,  true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (zipFilter  != null ? ListUtil.commaSeparatedString(zipFilter,  true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (jmodFilter != null ? ListUtil.commaSeparatedString(jmodFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (earFilter  != null ? ListUtil.commaSeparatedString(earFilter,  true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (warFilter  != null ? ListUtil.commaSeparatedString(warFilter,  true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (jarFilter  != null ? ListUtil.commaSeparatedString(jarFilter,  true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (filter     != null ? ListUtil.commaSeparatedString(filter,     true) : "")  +
            ConfigurationConstants.CLOSE_ARGUMENTS_KEYWORD;
    }

    return string;
}
 
Example #12
Source File: MappingKeeper.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void processMethodMapping(String className,
                                 int    firstLineNumber,
                                 int    lastLineNumber,
                                 String methodReturnType,
                                 String methodName,
                                 String methodArguments,
                                 String newMethodName)
{
    if (clazz != null)
    {
        // Find the method.
        String descriptor = ClassUtil.internalMethodDescriptor(methodReturnType,
                                                               ListUtil.commaSeparatedList(methodArguments));

        Method method = clazz.findMethod(methodName, descriptor);
        if (method != null)
        {
            // Print out a warning if the mapping conflicts with a name that
            // was set before.
            if (warningPrinter != null)
            {
                String currentNewName = MemberObfuscator.newMemberName(method);
                if (currentNewName != null &&
                    !currentNewName.equals(newMethodName))
                {
                    warningPrinter.print(ClassUtil.internalClassName(className),
                                         "Warning: " +
                                         className +
                                         ": method '" + methodReturnType + " " + methodName + ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN + methodArguments + ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE +
                                         "' is not being kept as '" + currentNewName +
                                         "', but remapped to '" + newMethodName + "'");
                }
            }

            // Make sure the mapping name will be kept.
            MemberObfuscator.setFixedNewMemberName(method, newMethodName);
        }
    }
}
 
Example #13
Source File: FilterDialog.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the filter currently represented in this dialog.
 */
public List getFilter()
{
    String filter = filterTextField.getText();

    return filter.equals(DEFAULT_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #14
Source File: FilterDialog.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the apk filter currently represented in this dialog.
 */
public List getApkFilter()
{
    String filter = apkFilterTextField.getText();

    return filter.equals(DEFAULT_APK_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #15
Source File: FilterDialog.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the jmod filter currently represented in this dialog.
 */
public List getJmodFilter()
{
    String filter = jmodFilterTextField.getText();

    return filter.equals(DEFAULT_JMOD_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #16
Source File: FilterDialog.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the jar filter currently represented in this dialog.
 */
public List getJarFilter()
{
    String filter = jarFilterTextField.getText();

    return filter.equals(DEFAULT_JAR_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #17
Source File: FilterDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the ear filter currently represented in this dialog.
 */
public List getEarFilter()
{
    String filter = earFilterTextField.getText();

    return filter.equals(DEFAULT_EAR_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #18
Source File: FilterElement.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the contents of this element to the given name filter.
 * @param filter   the list of attributes to be extended.
 * @param internal specifies whether the filter string should be converted
 *                 to internal types.
 */
public void appendTo(List filter, boolean internal)
{
    // Get the referenced element, or else this one.
    FilterElement filterElement = isReference() ?
        (FilterElement)getCheckedRef(this.getClass(),
                                     this.getClass().getName()) :
        this;

    String filterString = filterElement.filter;

    if (filterString == null)
    {
        // Clear the filter to keep all names.
        filter.clear();
    }
    else
    {
        if (internal)
        {
            filterString = ClassUtil.internalClassName(filterString);
        }

        // Append the filter.
        filter.addAll(ListUtil.commaSeparatedList(filterString));
    }
}
 
Example #19
Source File: FilterDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the war filter currently represented in this dialog.
 */
public List getWarFilter()
{
    String filter = warFilterTextField.getText();

    return filter.equals(DEFAULT_WAR_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #20
Source File: FilterDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the apk filter currently represented in this dialog.
 */
public List getApkFilter()
{
    String filter = apkFilterTextField.getText();

    return filter.equals(DEFAULT_APK_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #21
Source File: FilterDialog.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the zip filter currently represented in this dialog.
 */
public List getZipFilter()
{
    String filter = zipFilterTextField.getText();

    return filter.equals(DEFAULT_ZIP_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #22
Source File: ClassPathEntry.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public String toString()
{
    String string = getName();

    if (filter    != null ||
        jarFilter != null ||
        aarFilter != null ||
        warFilter != null ||
        earFilter != null ||
        zipFilter != null)
    {
        string +=
            ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD +
            (aarFilter != null ? ListUtil.commaSeparatedString(aarFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (apkFilter != null ? ListUtil.commaSeparatedString(apkFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (zipFilter != null ? ListUtil.commaSeparatedString(zipFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (earFilter != null ? ListUtil.commaSeparatedString(earFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (warFilter != null ? ListUtil.commaSeparatedString(warFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (jarFilter != null ? ListUtil.commaSeparatedString(jarFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (filter    != null ? ListUtil.commaSeparatedString(filter, true)    : "")  +
            ConfigurationConstants.CLOSE_ARGUMENTS_KEYWORD;
    }

    return string;
}
 
Example #23
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Extends the given class path with the given filtered input or output
 * files.
 */
private ClassPath extendClassPath(ClassPath classPath,
                                  Object    files,
                                  Map       filterArgs,
                                  boolean   output)
{
    ConfigurableFileCollection fileCollection = getProject().files(files);

    if (classPath == null)
    {
        classPath = new ClassPath();
    }

    Iterator fileIterator = fileCollection.iterator();
    while (fileIterator.hasNext())
    {
        File file = (File)fileIterator.next();
        if (output || file.exists())
        {
            // Create the class path entry.
            ClassPathEntry classPathEntry = new ClassPathEntry(file, output);

            // Add any filters to the class path entry.
            if (filterArgs != null)
            {
                classPathEntry.setFilter(ListUtil.commaSeparatedList((String)filterArgs.get("filter")));
                classPathEntry.setApkFilter(ListUtil.commaSeparatedList((String)filterArgs.get("apkfilter")));
                classPathEntry.setJarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("jarfilter")));
                classPathEntry.setAarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("aarfilter")));
                classPathEntry.setWarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("warfilter")));
                classPathEntry.setEarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("earfilter")));
                classPathEntry.setZipFilter(ListUtil.commaSeparatedList((String)filterArgs.get("zipfilter")));
            }

            classPath.add(classPathEntry);
        }
    }

    return classPath;
}
 
Example #24
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the given filter to the given list, creating a new list if
 * necessary. External class names are converted to internal class names,
 * if requested.
 */
private List extendFilter(List    filter,
                          String  filterString,
                          boolean convertExternalClassNames)
{
    if (filter == null)
    {
        filter = new ArrayList();
    }

    if (filterString == null)
    {
        // Clear the filter to keep all names.
        filter.clear();
    }
    else
    {
        if (convertExternalClassNames)
        {
            filterString = ClassUtil.internalClassName(filterString);
        }

        // Append the filter.
        filter.addAll(ListUtil.commaSeparatedList(filterString));
    }

    return filter;
}
 
Example #25
Source File: FilterDialog.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the filter currently represented in this dialog.
 */
public List getFilter()
{
    String filter = filterTextField.getText();

    return filter.equals(DEFAULT_FILTER) ? null : ListUtil.commaSeparatedList(filter);
}
 
Example #26
Source File: FilterElement.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the contents of this element to the given name filter.
 * @param filter   the list of attributes to be extended.
 * @param internal specifies whether the filter string should be converted
 *                 to internal types.
 */
public void appendTo(List filter, boolean internal)
{
    // Get the referenced element, or else this one.
    FilterElement filterElement = isReference() ?
        (FilterElement)getCheckedRef(this.getClass(),
                                     this.getClass().getName()) :
        this;

    String filterString = filterElement.filter;

    if (filterString == null)
    {
        // Clear the filter to keep all names.
        filter.clear();
    }
    else
    {
        if (internal)
        {
            filterString = ClassUtil.internalClassName(filterString);
        }

        // Append the filter.
        filter.addAll(ListUtil.commaSeparatedList(filterString));
    }
}
 
Example #27
Source File: ClassPathEntry.java    From bazel with Apache License 2.0 5 votes vote down vote up
public String toString()
{
    String string = getName();

    if (filter    != null ||
        jarFilter != null ||
        aarFilter != null ||
        warFilter != null ||
        earFilter != null ||
        zipFilter != null)
    {
        string +=
            ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD +
            (aarFilter != null ? ListUtil.commaSeparatedString(aarFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (apkFilter != null ? ListUtil.commaSeparatedString(apkFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (zipFilter != null ? ListUtil.commaSeparatedString(zipFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (earFilter != null ? ListUtil.commaSeparatedString(earFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (warFilter != null ? ListUtil.commaSeparatedString(warFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (jarFilter != null ? ListUtil.commaSeparatedString(jarFilter, true) : "")  +
            ConfigurationConstants.SEPARATOR_KEYWORD +
            (filter    != null ? ListUtil.commaSeparatedString(filter, true)    : "")  +
            ConfigurationConstants.CLOSE_ARGUMENTS_KEYWORD;
    }

    return string;
}
 
Example #28
Source File: ProGuardTask.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Extends the given class path with the given filtered input or output
 * files.
 */
private ClassPath extendClassPath(ClassPath classPath,
                                  Object    files,
                                  Map       filterArgs,
                                  boolean   output)
{
    ConfigurableFileCollection fileCollection = getProject().files(files);

    if (classPath == null)
    {
        classPath = new ClassPath();
    }

    Iterator fileIterator = fileCollection.iterator();
    while (fileIterator.hasNext())
    {
        File file = (File)fileIterator.next();
        if (output || file.exists())
        {
            // Create the class path entry.
            ClassPathEntry classPathEntry = new ClassPathEntry(file, output);

            // Add any filters to the class path entry.
            if (filterArgs != null)
            {
                classPathEntry.setFilter(ListUtil.commaSeparatedList((String)filterArgs.get("filter")));
                classPathEntry.setApkFilter(ListUtil.commaSeparatedList((String)filterArgs.get("apkfilter")));
                classPathEntry.setJarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("jarfilter")));
                classPathEntry.setAarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("aarfilter")));
                classPathEntry.setWarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("warfilter")));
                classPathEntry.setEarFilter(ListUtil.commaSeparatedList((String)filterArgs.get("earfilter")));
                classPathEntry.setZipFilter(ListUtil.commaSeparatedList((String)filterArgs.get("zipfilter")));
            }

            classPath.add(classPathEntry);
        }
    }

    return classPath;
}
 
Example #29
Source File: ProGuardTask.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the given filter to the given list, creating a new list if
 * necessary. External class names are converted to internal class names,
 * if requested.
 */
private List extendFilter(List    filter,
                          String  filterString,
                          boolean convertExternalClassNames)
{
    if (filter == null)
    {
        filter = new ArrayList();
    }

    if (filterString == null)
    {
        // Clear the filter to keep all names.
        filter.clear();
    }
    else
    {
        if (convertExternalClassNames)
        {
            filterString = ClassUtil.internalClassName(filterString);
        }

        // Append the filter.
        filter.addAll(ListUtil.commaSeparatedList(filterString));
    }

    return filter;
}
 
Example #30
Source File: FilterElement.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the contents of this element to the given name filter.
 * @param filter   the list of attributes to be extended.
 * @param internal specifies whether the filter string should be converted
 *                 to internal types.
 */
public void appendTo(List filter, boolean internal)
{
    // Get the referenced element, or else this one.
    FilterElement filterElement = isReference() ?
        (FilterElement)getCheckedRef(this.getClass(),
                                     this.getClass().getName()) :
        this;

    String filterString = filterElement.filter;

    if (filterString == null)
    {
        // Clear the filter to keep all names.
        filter.clear();
    }
    else
    {
        if (internal)
        {
            filterString = ClassUtil.internalClassName(filterString);
        }

        // Append the filter.
        filter.addAll(ListUtil.commaSeparatedList(filterString));
    }
}