Java Code Examples for proguard.classfile.util.MethodLinker

The following examples show how to use proguard.classfile.util.MethodLinker. These examples are extracted from open source projects. 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
private static void markNoSideEffects(Method method)
{
    MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method);
    if (info != null)
    {
        info.setNoSideEffects();
    }
    else
    {
        MethodLinker.lastMember(method).setVisitorInfo(KEPT_BUT_NO_SIDE_EFFECTS);
    }
}
 
Example 2
public static boolean hasNoSideEffects(Method method)
{
    if (MethodLinker.lastVisitorAccepter(method).getVisitorInfo() == KEPT_BUT_NO_SIDE_EFFECTS)
    {
        return true;
    }

    MethodOptimizationInfo info = MethodOptimizationInfo.getMethodOptimizationInfo(method);
    return info != null &&
           info.hasNoSideEffects();
}
 
Example 3
public static MethodOptimizationInfo getMethodOptimizationInfo(Method method)
{
    Object visitorInfo = MethodLinker.lastMember(method).getVisitorInfo();

    return visitorInfo instanceof MethodOptimizationInfo ?
        (MethodOptimizationInfo)visitorInfo :
        null;
}
 
Example 4
Source Project: java-n-IDE-for-Android   Source File: MemberObfuscator.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Assigns a fixed new name to the given class member.
 * @param member the class member.
 * @param name   the new name.
 */
static void setFixedNewMemberName(Member member, String name)
{
    VisitorAccepter lastVisitorAccepter = MethodLinker.lastVisitorAccepter(member);

    if (!(lastVisitorAccepter instanceof LibraryMember) &&
        !(lastVisitorAccepter instanceof MyFixedName))
    {
        lastVisitorAccepter.setVisitorInfo(new MyFixedName(name));
    }
    else
    {
        lastVisitorAccepter.setVisitorInfo(name);
    }
}
 
Example 5
Source Project: java-n-IDE-for-Android   Source File: MemberObfuscator.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether the new name of the given class member is fixed.
 * @param member the class member.
 * @return whether its new name is fixed.
 */
static boolean hasFixedNewMemberName(Member member)
{
    VisitorAccepter lastVisitorAccepter = MethodLinker.lastVisitorAccepter(member);

    return lastVisitorAccepter instanceof LibraryMember ||
           lastVisitorAccepter instanceof MyFixedName;
}
 
Example 6
Source Project: proguard   Source File: KeepMarker.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static boolean isKept(VisitorAccepter visitorAccepter)
{
    // We're also checking for the constant in NoSideEffectMethodMarker,
    // to keep things simple.
    Object visitorInfo =
        MethodLinker.lastVisitorAccepter(visitorAccepter).getVisitorInfo();

    return visitorInfo == KEPT ||
           visitorInfo == NoSideEffectMethodMarker.KEPT_BUT_NO_SIDE_EFFECTS;
}
 
Example 7
Source Project: bazel   Source File: KeepMarker.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isKept(VisitorAccepter visitorAccepter)
{
    // We're also checking for the constant in NoSideEffectMethodMarker,
    // to keep things simple.
    Object visitorInfo =
        MethodLinker.lastVisitorAccepter(visitorAccepter).getVisitorInfo();

    return visitorInfo == KEPT ||
           visitorInfo == NoSideEffectMethodMarker.KEPT_BUT_NO_SIDE_EFFECTS;
}
 
Example 8
public static void setMethodOptimizationInfo(Clazz clazz, Method method)
{
    MethodLinker.lastMember(method).setProcessingInfo(new MethodOptimizationInfo());
}
 
Example 9
public static MethodOptimizationInfo getMethodOptimizationInfo(Method method)
{
    return (MethodOptimizationInfo)MethodLinker.lastMember(method).getProcessingInfo();
}
 
Example 10
public static void setMethodOptimizationInfo(Clazz clazz, Method method)
{
    MethodLinker.lastMember(method).setVisitorInfo(new MethodOptimizationInfo(clazz, method));
}
 
Example 11
Source Project: java-n-IDE-for-Android   Source File: KeepMarker.java    License: Apache License 2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example 12
Source Project: java-n-IDE-for-Android   Source File: KeepMarker.java    License: Apache License 2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example 13
Source Project: java-n-IDE-for-Android   Source File: KeepMarker.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isKept(VisitorAccepter visitorAccepter)
{
    return MethodLinker.lastVisitorAccepter(visitorAccepter).getVisitorInfo() == KEPT;
}
 
Example 14
Source Project: proguard   Source File: KeepMarker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example 15
Source Project: proguard   Source File: KeepMarker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example 16
Source Project: bazel   Source File: KeepMarker.java    License: Apache License 2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example 17
Source Project: bazel   Source File: KeepMarker.java    License: Apache License 2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example 18
Source Project: java-n-IDE-for-Android   Source File: MemberObfuscator.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Assigns a new name to the given class member.
 * @param member the class member.
 * @param name   the new name.
 */
static void setNewMemberName(Member member, String name)
{
    MethodLinker.lastVisitorAccepter(member).setVisitorInfo(name);
}
 
Example 19
Source Project: java-n-IDE-for-Android   Source File: MemberObfuscator.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the new name of the given class member.
 * @param member the class member.
 * @return the class member's new name, or <code>null</code> if it doesn't
 *         have one yet.
 */
static String newMemberName(Member member)
{
    return (String) MethodLinker.lastVisitorAccepter(member).getVisitorInfo();
}