proguard.classfile.attribute.visitor.ExceptionInfoVisitor Java Examples

The following examples show how to use proguard.classfile.attribute.visitor.ExceptionInfoVisitor. 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: CodeAttribute.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given exception visitor to all exceptions.
 */
public void exceptionsAccept(Clazz clazz, Method method, ExceptionInfoVisitor exceptionInfoVisitor)
{
    for (int index = 0; index < u2exceptionTableLength; index++)
    {
        // We don't need double dispatching here, since there is only one
        // type of ExceptionInfo.
        exceptionInfoVisitor.visitExceptionInfo(clazz, method, this, exceptionTable[index]);
    }
}
 
Example #2
Source File: ExceptionHandlerFilter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionHandlerFilter.
 * @param startOffset          the start of the instruction offset range.
 * @param endOffset            the end of the instruction offset range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionHandlerFilter(int                  startOffset,
                              int                  endOffset,
                              ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #3
Source File: ExceptionExcludedOffsetFilter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionExcludedOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionExcludedOffsetFilter(int                  instructionOffset,
                                     ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #4
Source File: ExceptionOffsetFilter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionOffsetFilter(int                  instructionOffset,
                             ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #5
Source File: ExceptionRangeFilter.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionRangeFilter.
 * @param startOffset          the start offset of the instruction range.
 * @param endOffset            the end offset of the instruction range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionRangeFilter(int                  startOffset,
                            int                  endOffset,
                            ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #6
Source File: ExceptionHandlerFilter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionHandlerFilter.
 * @param startOffset          the start of the instruction offset range.
 * @param endOffset            the end of the instruction offset range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionHandlerFilter(int                  startOffset,
                              int                  endOffset,
                              ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #7
Source File: ExceptionExcludedOffsetFilter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionExcludedOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionExcludedOffsetFilter(int                  instructionOffset,
                                     ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #8
Source File: ExceptionOffsetFilter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionOffsetFilter(int                  instructionOffset,
                             ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #9
Source File: ExceptionRangeFilter.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionRangeFilter.
 * @param startOffset          the start offset of the instruction range.
 * @param endOffset            the end offset of the instruction range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionRangeFilter(int                  startOffset,
                            int                  endOffset,
                            ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #10
Source File: ExceptionHandlerFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionHandlerFilter.
 * @param startOffset          the start of the instruction offset range.
 * @param endOffset            the end of the instruction offset range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionHandlerFilter(int                  startOffset,
                              int                  endOffset,
                              ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #11
Source File: ExceptionExcludedOffsetFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionExcludedOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionExcludedOffsetFilter(int                  instructionOffset,
                                     ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #12
Source File: ExceptionOffsetFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionOffsetFilter.
 * @param instructionOffset    the instruction offset.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionOffsetFilter(int                  instructionOffset,
                             ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.instructionOffset    = instructionOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #13
Source File: ExceptionRangeFilter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ExceptionRangeFilter.
 * @param startOffset          the start offset of the instruction range.
 * @param endOffset            the end offset of the instruction range.
 * @param exceptionInfoVisitor the ExceptionInfoVisitor to which visits
 *                             will be delegated.
 */
public ExceptionRangeFilter(int                  startOffset,
                            int                  endOffset,
                            ExceptionInfoVisitor exceptionInfoVisitor)
{
    this.startOffset          = startOffset;
    this.endOffset            = endOffset;
    this.exceptionInfoVisitor = exceptionInfoVisitor;
}
 
Example #14
Source File: CodeAttribute.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given exception visitor to all exceptions that are applicable
 * to any of the instructions in the specified range of offsets.
 */
public void exceptionsAccept(Clazz clazz, Method method, int startOffset, int endOffset, ExceptionInfoVisitor exceptionInfoVisitor)
{
    for (int index = 0; index < u2exceptionTableLength; index++)
    {
        ExceptionInfo exceptionInfo = exceptionTable[index];
        if (exceptionInfo.isApplicable(startOffset, endOffset))
        {
            exceptionInfoVisitor.visitExceptionInfo(clazz, method, this, exceptionInfo);
        }
    }
}
 
Example #15
Source File: CodeAttribute.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given exception visitor to all exceptions that are applicable
 * to the instruction at the specified offset.
 */
public void exceptionsAccept(Clazz clazz, Method method, int offset, ExceptionInfoVisitor exceptionInfoVisitor)
{
    for (int index = 0; index < u2exceptionTableLength; index++)
    {
        ExceptionInfo exceptionInfo = exceptionTable[index];
        if (exceptionInfo.isApplicable(offset))
        {
            exceptionInfoVisitor.visitExceptionInfo(clazz, method, this, exceptionInfo);
        }
    }
}
 
Example #16
Source File: CodeSubroutineInliner.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Appends the specified subroutine.
 */
private void inlineSubroutine(Clazz         clazz,
                              Method        method,
                              CodeAttribute codeAttribute,
                              int           subroutineInvocationOffset,
                              int           subroutineStart)
{
    int subroutineEnd = branchTargetFinder.subroutineEnd(subroutineStart);

    if (DEBUG)
    {
        System.out.println("  Inlining subroutine ["+subroutineStart+" -> "+subroutineEnd+"] at ["+subroutineInvocationOffset+"]");
    }

    // Don't go inlining exceptions that are already applicable to this
    // subroutine invocation.
    ExceptionInfoVisitor oldSubroutineExceptionInliner = subroutineExceptionInliner;
    int                  oldClipStart                  = clipStart;
    int                  oldClipEnd                    = clipEnd;

    subroutineExceptionInliner =
        new ExceptionExcludedOffsetFilter(subroutineInvocationOffset,
                                          subroutineExceptionInliner);
    clipStart = subroutineStart;
    clipEnd   = subroutineEnd;

    codeAttributeComposer.beginCodeFragment(codeAttribute.u4codeLength);

    // Copy the subroutine instructions, inlining any subroutine calls
    // recursively.
    codeAttribute.instructionsAccept(clazz,
                                     method,
                                     subroutineStart,
                                     subroutineEnd,
                                     this);

    if (DEBUG)
    {
        System.out.println("    Appending label after inlined subroutine at ["+subroutineEnd+"]");
    }

    // Append a label just after the code.
    codeAttributeComposer.appendLabel(subroutineEnd);

    // Inline the subroutine exceptions.
    codeAttribute.exceptionsAccept(clazz,
                                   method,
                                   subroutineStart,
                                   subroutineEnd,
                                   subroutineExceptionInliner);

    // We can again inline exceptions that are applicable to this
    // subroutine invocation.
    subroutineExceptionInliner = oldSubroutineExceptionInliner;
    clipStart                  = oldClipStart;
    clipEnd                    = oldClipEnd;

    codeAttributeComposer.endCodeFragment();
}
 
Example #17
Source File: UnreachableExceptionRemover.java    From java-n-IDE-for-Android with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new UnreachableExceptionRemover.
 * @param extraExceptionInfoVisitor an optional extra visitor for all
 *                                  removed exceptions.
 */
public UnreachableExceptionRemover(ExceptionInfoVisitor extraExceptionInfoVisitor)
{
    this.extraExceptionInfoVisitor = extraExceptionInfoVisitor;
}