Java Code Examples for proguard.classfile.util.ClassUtil#internalClassVersion()

The following examples show how to use proguard.classfile.util.ClassUtil#internalClassVersion() . 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: ConfigurationParser.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private int parseClassVersion()
throws ParseException, IOException
{
    // Read the obligatory target.
    readNextWord("java version");

    int classVersion = ClassUtil.internalClassVersion(nextWord);
    if (classVersion == 0)
    {
        throw new ParseException("Unsupported java version " + reader.locationDescription());
    }

    readNextWord();

    return classVersion;
}
 
Example 2
Source File: ConfigurationParser.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private int parseClassVersion()
throws ParseException, IOException
{
    // Read the obligatory target.
    readNextWord("java version");

    int classVersion = ClassUtil.internalClassVersion(nextWord);
    if (classVersion == 0)
    {
        throw new ParseException("Unsupported java version " + reader.locationDescription());
    }

    readNextWord();

    return classVersion;
}
 
Example 3
Source File: ConfigurationParser.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private int parseClassVersion()
throws ParseException, IOException
{
    // Read the obligatory target.
    readNextWord("java version");

    int classVersion = ClassUtil.internalClassVersion(nextWord);
    if (classVersion == 0)
    {
        throw new ParseException("Unsupported java version " + reader.locationDescription());
    }

    readNextWord();

    return classVersion;
}
 
Example 4
Source File: ConfigurationParser.java    From bazel with Apache License 2.0 6 votes vote down vote up
private int parseClassVersion()
throws ParseException, IOException
{
    // Read the obligatory target.
    readNextWord("java version");

    int classVersion = ClassUtil.internalClassVersion(nextWord);
    if (classVersion == 0)
    {
        throw new ParseException("Unsupported java version " + reader.locationDescription());
    }

    readNextWord();

    return classVersion;
}
 
Example 5
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public void setTarget(String target)
{
    configuration.targetClassVersion = ClassUtil.internalClassVersion(target);
    if (configuration.targetClassVersion == 0)
    {
        throw new BuildException("Unsupported target '"+target+"'");
    }
}
 
Example 6
Source File: KeepOnlyConfigurationParser.java    From atlas with Apache License 2.0 5 votes vote down vote up
private int parseClassVersion()
    throws ParseException, IOException {
    // Read the obligatory target.
    readNextWord("java version");

    int classVersion = ClassUtil.internalClassVersion(nextWord);
    if (classVersion == 0) {
        throw new ParseException("Unsupported java version " + reader.locationDescription());
    }

    readNextWord();

    return classVersion;
}
 
Example 7
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public void setTarget(String target)
{
    configuration.targetClassVersion = ClassUtil.internalClassVersion(target);
    if (configuration.targetClassVersion == 0)
    {
        throw new BuildException("Unsupported target '"+target+"'");
    }
}
 
Example 8
Source File: ProGuardTask.java    From bazel with Apache License 2.0 5 votes vote down vote up
public void setTarget(String target)
{
    configuration.targetClassVersion = ClassUtil.internalClassVersion(target);
    if (configuration.targetClassVersion == 0)
    {
        throw new BuildException("Unsupported target '"+target+"'");
    }
}
 
Example 9
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public void target(String targetClassVersion)
{
    configuration.targetClassVersion =
        ClassUtil.internalClassVersion(targetClassVersion);
}
 
Example 10
Source File: ProgramClassReader.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitProgramClass(ProgramClass programClass)
{
    // Read and check the magic number.
    programClass.u4magic = dataInput.readInt();

    ClassUtil.checkMagicNumber(programClass.u4magic);

    // Read and check the version numbers.
    int u2minorVersion = dataInput.readUnsignedShort();
    int u2majorVersion = dataInput.readUnsignedShort();

    programClass.u4version = ClassUtil.internalClassVersion(u2majorVersion,
                                                            u2minorVersion);

    ClassUtil.checkVersionNumbers(programClass.u4version);

    // Read the constant pool. Note that the first entry is not used.
    programClass.u2constantPoolCount = dataInput.readUnsignedShort();

    programClass.constantPool = new Constant[programClass.u2constantPoolCount];
    for (int index = 1; index < programClass.u2constantPoolCount; index++)
    {
        Constant constant = createConstant();
        constant.accept(programClass, this);
        programClass.constantPool[index] = constant;

        // Long constants and double constants take up two entries in the
        // constant pool.
        int tag = constant.getTag();
        if (tag == ClassConstants.CONSTANT_Long ||
            tag == ClassConstants.CONSTANT_Double)
        {
            programClass.constantPool[++index] = null;
        }
    }

    // Read the general class information.
    programClass.u2accessFlags = dataInput.readUnsignedShort();
    programClass.u2thisClass   = dataInput.readUnsignedShort();
    programClass.u2superClass  = dataInput.readUnsignedShort();

    // Read the interfaces.
    programClass.u2interfacesCount = dataInput.readUnsignedShort();

    programClass.u2interfaces = new int[programClass.u2interfacesCount];
    for (int index = 0; index < programClass.u2interfacesCount; index++)
    {
        programClass.u2interfaces[index] = dataInput.readUnsignedShort();
    }

    // Read the fields.
    programClass.u2fieldsCount = dataInput.readUnsignedShort();

    programClass.fields = new ProgramField[programClass.u2fieldsCount];
    for (int index = 0; index < programClass.u2fieldsCount; index++)
    {
        ProgramField programField = new ProgramField();
        this.visitProgramField(programClass, programField);
        programClass.fields[index] = programField;
    }

    // Read the methods.
    programClass.u2methodsCount = dataInput.readUnsignedShort();

    programClass.methods = new ProgramMethod[programClass.u2methodsCount];
    for (int index = 0; index < programClass.u2methodsCount; index++)
    {
        ProgramMethod programMethod = new ProgramMethod();
        this.visitProgramMethod(programClass, programMethod);
        programClass.methods[index] = programMethod;
    }

    // Read the class attributes.
    programClass.u2attributesCount = dataInput.readUnsignedShort();

    programClass.attributes = new Attribute[programClass.u2attributesCount];
    for (int index = 0; index < programClass.u2attributesCount; index++)
    {
        Attribute attribute = createAttribute(programClass);
        attribute.accept(programClass, this);
        programClass.attributes[index] = attribute;
    }
}
 
Example 11
Source File: ProGuardTask.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public void target(String targetClassVersion)
{
    configuration.targetClassVersion =
        ClassUtil.internalClassVersion(targetClassVersion);
}
 
Example 12
Source File: ProGuardTask.java    From bazel with Apache License 2.0 4 votes vote down vote up
public void target(String targetClassVersion)
{
    configuration.targetClassVersion =
        ClassUtil.internalClassVersion(targetClassVersion);
}