proguard.classfile.visitor.ClassVersionSetter Java Examples

The following examples show how to use proguard.classfile.visitor.ClassVersionSetter. 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: Targeter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the target version on classes in the given program class pool.
 */
public void execute(ClassPool programClassPool) throws IOException
{
    Set newerClassVersions = configuration.warn != null ? null : new HashSet();

    programClassPool.classesAccept(new ClassVersionSetter(configuration.targetClassVersion,
                                                          newerClassVersions));

    if (newerClassVersions != null &&
        newerClassVersions.size() > 0)
    {
        System.err.print("Warning: some classes have more recent versions (");

        Iterator iterator = newerClassVersions.iterator();
        while (iterator.hasNext())
        {
            Integer classVersion = (Integer)iterator.next();
            System.err.print(ClassUtil.externalClassVersion(classVersion.intValue()));

            if (iterator.hasNext())
            {
                System.err.print(",");
            }
        }

        System.err.println(")");
        System.err.println("         than the target version ("+ClassUtil.externalClassVersion(configuration.targetClassVersion)+").");

        if (!configuration.ignoreWarnings)
        {
            System.err.println("         If you are sure this is not a problem,");
            System.err.println("         you could try your luck using the '-ignorewarnings' option.");
            throw new IOException("Please correct the above warnings first.");
        }
    }
}
 
Example #2
Source File: Targeter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the target version on classes in the given program class pool.
 */
public void execute(ClassPool programClassPool) throws IOException
{
    Set newerClassVersions = configuration.warn != null ? null : new HashSet();

    programClassPool.classesAccept(new ClassVersionSetter(configuration.targetClassVersion,
                                                          newerClassVersions));

    if (newerClassVersions != null &&
        newerClassVersions.size() > 0)
    {
        System.err.print("Warning: some classes have more recent versions (");

        Iterator iterator = newerClassVersions.iterator();
        while (iterator.hasNext())
        {
            Integer classVersion = (Integer)iterator.next();
            System.err.print(ClassUtil.externalClassVersion(classVersion.intValue()));

            if (iterator.hasNext())
            {
                System.err.print(",");
            }
        }

        System.err.println(")");
        System.err.println("         than the target version ("+ClassUtil.externalClassVersion(configuration.targetClassVersion)+").");

        if (!configuration.ignoreWarnings)
        {
            System.err.println("         If you are sure this is not a problem,");
            System.err.println("         you could try your luck using the '-ignorewarnings' option.");
            throw new IOException("Please correct the above warnings first.");
        }
    }
}
 
Example #3
Source File: Targeter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the target version on classes in the given program class pool.
 */
public void execute(ClassPool programClassPool) throws IOException
{
    Set newerClassVersions = configuration.warn != null ? null : new HashSet();

    programClassPool.classesAccept(new ClassVersionSetter(configuration.targetClassVersion,
                                                          newerClassVersions));

    if (newerClassVersions != null &&
        newerClassVersions.size() > 0)
    {
        System.err.print("Warning: some classes have more recent versions (");

        Iterator iterator = newerClassVersions.iterator();
        while (iterator.hasNext())
        {
            Integer classVersion = (Integer)iterator.next();
            System.err.print(ClassUtil.externalClassVersion(classVersion.intValue()));

            if (iterator.hasNext())
            {
                System.err.print(",");
            }
        }

        System.err.println(")");
        System.err.println("         than the target version ("+ClassUtil.externalClassVersion(configuration.targetClassVersion)+").");

        if (!configuration.ignoreWarnings)
        {
            System.err.println("         If you are sure this is not a problem,");
            System.err.println("         you could try your luck using the '-ignorewarnings' option.");
            throw new IOException("Please correct the above warnings first.");
        }
    }
}
 
Example #4
Source File: Targeter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the target version on classes in the given program class pool.
 */
public void execute(ClassPool programClassPool) throws IOException
{
    Set newerClassVersions = configuration.warn != null ? null : new HashSet();

    programClassPool.classesAccept(new ClassVersionSetter(configuration.targetClassVersion,
                                                          newerClassVersions));

    if (newerClassVersions != null &&
        newerClassVersions.size() > 0)
    {
        System.err.print("Warning: some classes have more recent versions (");

        Iterator iterator = newerClassVersions.iterator();
        while (iterator.hasNext())
        {
            Integer classVersion = (Integer)iterator.next();
            System.err.print(ClassUtil.externalClassVersion(classVersion.intValue()));

            if (iterator.hasNext())
            {
                System.err.print(",");
            }
        }

        System.err.println(")");
        System.err.println("         than the target version ("+ClassUtil.externalClassVersion(configuration.targetClassVersion)+").");

        if (!configuration.ignoreWarnings)
        {
            System.err.println("         If you are sure this is not a problem,");
            System.err.println("         you could try your luck using the '-ignorewarnings' option.");
            throw new IOException("Please correct the above warnings first.");
        }
    }
}