proguard.classfile.attribute.ExceptionsAttribute Java Examples

The following examples show how to use proguard.classfile.attribute.ExceptionsAttribute. 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: AttributeAdder.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    // Create a new exceptions attribute.
    ExceptionsAttribute newExceptionsAttribute =
        new ExceptionsAttribute(constantAdder.addConstant(clazz, exceptionsAttribute.u2attributeNameIndex),
                                0,
                                exceptionsAttribute.u2exceptionIndexTableLength > 0 ?
                                    new int[exceptionsAttribute.u2exceptionIndexTableLength] :
                                    EMPTY_INTS);

    // Add the exceptions.
    exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz,
                                               new ExceptionAdder(targetClass,
                                                                  newExceptionsAttribute));

    // Add it to the target method.
    attributesEditor.addAttribute(newExceptionsAttribute);
}
 
Example #2
Source File: RequiredAttributeFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    if (optionalAttributeVisitor != null)
    {
        exceptionsAttribute.accept(clazz, method, optionalAttributeVisitor);
    }
}
 
Example #3
Source File: ExceptionAdder.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionAdder that will copy classes into the given
 * target exceptions attribute.
 */
public ExceptionAdder(ProgramClass        targetClass,
                      ExceptionsAttribute targetExceptionsAttribute)
{
    constantAdder             = new ConstantAdder(targetClass);
    exceptionsAttributeEditor = new ExceptionsAttributeEditor(targetExceptionsAttribute);
}
 
Example #4
Source File: ExceptionAdder.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionAdder that will copy classes into the given
 * target exceptions attribute.
 */
public ExceptionAdder(ProgramClass        targetClass,
                      ExceptionsAttribute targetExceptionsAttribute)
{
    constantAdder             = new ConstantAdder(targetClass);
    exceptionsAttributeEditor = new ExceptionsAttributeEditor(targetExceptionsAttribute);
}
 
Example #5
Source File: ProgramClassReader.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private Attribute createAttribute(Clazz clazz)
{
    int u2attributeNameIndex = dataInput.readUnsignedShort();
    int u4attributeLength    = dataInput.readInt();
    String attributeName     = clazz.getString(u2attributeNameIndex);
    Attribute attribute =
        attributeName.equals(ClassConstants.ATTR_SourceFile)                           ? (Attribute)new SourceFileAttribute():
        attributeName.equals(ClassConstants.ATTR_SourceDir)                            ? (Attribute)new SourceDirAttribute():
        attributeName.equals(ClassConstants.ATTR_InnerClasses)                         ? (Attribute)new InnerClassesAttribute():
        attributeName.equals(ClassConstants.ATTR_EnclosingMethod)                      ? (Attribute)new EnclosingMethodAttribute():
        attributeName.equals(ClassConstants.ATTR_Deprecated)                           ? (Attribute)new DeprecatedAttribute():
        attributeName.equals(ClassConstants.ATTR_Synthetic)                            ? (Attribute)new SyntheticAttribute():
        attributeName.equals(ClassConstants.ATTR_Signature)                            ? (Attribute)new SignatureAttribute():
        attributeName.equals(ClassConstants.ATTR_ConstantValue)                        ? (Attribute)new ConstantValueAttribute():
        attributeName.equals(ClassConstants.ATTR_Exceptions)                           ? (Attribute)new ExceptionsAttribute():
        attributeName.equals(ClassConstants.ATTR_Code)                                 ? (Attribute)new CodeAttribute():
        attributeName.equals(ClassConstants.ATTR_StackMap)                             ? (Attribute)new StackMapAttribute():
        attributeName.equals(ClassConstants.ATTR_StackMapTable)                        ? (Attribute)new StackMapTableAttribute():
        attributeName.equals(ClassConstants.ATTR_LineNumberTable)                      ? (Attribute)new LineNumberTableAttribute():
        attributeName.equals(ClassConstants.ATTR_LocalVariableTable)                   ? (Attribute)new LocalVariableTableAttribute():
        attributeName.equals(ClassConstants.ATTR_LocalVariableTypeTable)               ? (Attribute)new LocalVariableTypeTableAttribute():
        attributeName.equals(ClassConstants.ATTR_RuntimeVisibleAnnotations)            ? (Attribute)new RuntimeVisibleAnnotationsAttribute():
        attributeName.equals(ClassConstants.ATTR_RuntimeInvisibleAnnotations)          ? (Attribute)new RuntimeInvisibleAnnotationsAttribute():
        attributeName.equals(ClassConstants.ATTR_RuntimeVisibleParameterAnnotations)   ? (Attribute)new RuntimeVisibleParameterAnnotationsAttribute():
        attributeName.equals(ClassConstants.ATTR_RuntimeInvisibleParameterAnnotations) ? (Attribute)new RuntimeInvisibleParameterAnnotationsAttribute():
        attributeName.equals(ClassConstants.ATTR_AnnotationDefault)                    ? (Attribute)new AnnotationDefaultAttribute():
                                                                                         (Attribute)new UnknownAttribute(u4attributeLength);
    attribute.u2attributeNameIndex = u2attributeNameIndex;

    return attribute;
}
 
Example #6
Source File: ProgramClassReader.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    // Read the exceptions.
    exceptionsAttribute.u2exceptionIndexTableLength = dataInput.readUnsignedShort();

    exceptionsAttribute.u2exceptionIndexTable = new int[exceptionsAttribute.u2exceptionIndexTableLength];
    for (int index = 0; index < exceptionsAttribute.u2exceptionIndexTableLength; index++)
    {
        exceptionsAttribute.u2exceptionIndexTable[index] = dataInput.readUnsignedShort();
    }
}
 
Example #7
Source File: ProgramClassWriter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    // Write the exceptions.
    dataOutput.writeShort(exceptionsAttribute.u2exceptionIndexTableLength);

    for (int index = 0; index < exceptionsAttribute.u2exceptionIndexTableLength; index++)
    {
        dataOutput.writeShort(exceptionsAttribute.u2exceptionIndexTable[index]);
    }
}
 
Example #8
Source File: ConstantPoolRemapper.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    exceptionsAttribute.u2attributeNameIndex =
        remapConstantIndex(exceptionsAttribute.u2attributeNameIndex);

    // Remap the constant pool references of the exceptions.
    remapConstantIndexArray(exceptionsAttribute.u2exceptionIndexTable,
                            exceptionsAttribute.u2exceptionIndexTableLength);
}
 
Example #9
Source File: ExceptionAdder.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionAdder that will copy classes into the given
 * target exceptions attribute.
 */
public ExceptionAdder(ProgramClass        targetClass,
                      ExceptionsAttribute targetExceptionsAttribute)
{
    constantAdder             = new ConstantAdder(targetClass);
    exceptionsAttributeEditor = new ExceptionsAttributeEditor(targetExceptionsAttribute);
}
 
Example #10
Source File: ClassPrinter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    println(visitorInfo(exceptionsAttribute) +
            " Exceptions attribute (count = " + exceptionsAttribute.u2exceptionIndexTableLength + ")");

    indent();
    exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz, this);
    outdent();
}
 
Example #11
Source File: AttributeNameFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    if (accepted(clazz, exceptionsAttribute))
    {
        exceptionsAttribute.accept(clazz, method, attributeVisitor);
    }
}
 
Example #12
Source File: MultiAttributeVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    for (int index = 0; index < attributeVisitors.length; index++)
    {
        attributeVisitors[index].visitExceptionsAttribute(clazz, method, exceptionsAttribute);
    }
}
 
Example #13
Source File: NonEmptyAttributeFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    if (exceptionsAttribute.u2exceptionIndexTableLength > 0)
    {
        exceptionsAttribute.accept(clazz, method, attributeVisitor);
    }
}
 
Example #14
Source File: UsageMarker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    markAsUsed(exceptionsAttribute);

    markConstant(clazz, exceptionsAttribute.u2attributeNameIndex);

    // Mark the constant pool entries referenced by the exceptions.
    exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz, this);
}
 
Example #15
Source File: SimplifiedVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    visitAnyAttribute(clazz, exceptionsAttribute);
}
 
Example #16
Source File: ClassCleaner.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    clean(exceptionsAttribute);

    exceptionsAttribute.exceptionEntriesAccept((ProgramClass)clazz, this);
}
 
Example #17
Source File: ExceptionsAttributeEditor.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new ExceptionsAttributeEditor that will edit exceptions in the
 * given exceptions attribute.
 */
public ExceptionsAttributeEditor(ExceptionsAttribute targetExceptionsAttribute)
{
    this.targetExceptionsAttribute = targetExceptionsAttribute;
}
 
Example #18
Source File: ChangedCodePrinter.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    attributeVisitor.visitExceptionsAttribute(clazz, method, exceptionsAttribute);
}
 
Example #19
Source File: Utf8UsageMarker.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute)
{
    markCpUtf8Entry(clazz, exceptionsAttribute.u2attributeNameIndex);
}
 
Example #20
Source File: ExceptionsAttributeEditor.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new ExceptionsAttributeEditor that will edit exceptions in the
 * given exceptions attribute.
 */
public ExceptionsAttributeEditor(ExceptionsAttribute targetExceptionsAttribute)
{
    this.targetExceptionsAttribute = targetExceptionsAttribute;
}
 
Example #21
Source File: ExceptionsAttributeEditor.java    From bazel with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new ExceptionsAttributeEditor that will edit exceptions in the
 * given exceptions attribute.
 */
public ExceptionsAttributeEditor(ExceptionsAttribute targetExceptionsAttribute)
{
    this.targetExceptionsAttribute = targetExceptionsAttribute;
}
 
Example #22
Source File: AttributeVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 votes vote down vote up
public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute);