proguard.classfile.util.MethodLinker Java Examples

The following examples show how to use proguard.classfile.util.MethodLinker. 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: MemberObfuscator.java    From java-n-IDE-for-Android with 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 #2
Source File: KeepMarker.java    From bazel with 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 #3
Source File: KeepMarker.java    From proguard with 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 #4
Source File: MemberObfuscator.java    From java-n-IDE-for-Android with 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 #5
Source File: MethodOptimizationInfo.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public static MethodOptimizationInfo getMethodOptimizationInfo(Method method)
{
    Object visitorInfo = MethodLinker.lastMember(method).getVisitorInfo();

    return visitorInfo instanceof MethodOptimizationInfo ?
        (MethodOptimizationInfo)visitorInfo :
        null;
}
 
Example #6
Source File: NoSideEffectMethodMarker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
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 #7
Source File: NoSideEffectMethodMarker.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
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 #8
Source File: MethodOptimizationInfo.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public static void setMethodOptimizationInfo(Clazz clazz, Method method)
{
    MethodLinker.lastMember(method).setVisitorInfo(new MethodOptimizationInfo(clazz, method));
}
 
Example #9
Source File: KeepMarker.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example #10
Source File: KeepMarker.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example #11
Source File: KeepMarker.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public static boolean isKept(VisitorAccepter visitorAccepter)
{
    return MethodLinker.lastVisitorAccepter(visitorAccepter).getVisitorInfo() == KEPT;
}
 
Example #12
Source File: MethodOptimizationInfo.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public static void setMethodOptimizationInfo(Clazz clazz, Method method)
{
    MethodLinker.lastMember(method).setProcessingInfo(new MethodOptimizationInfo());
}
 
Example #13
Source File: KeepMarker.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example #14
Source File: KeepMarker.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example #15
Source File: KeepMarker.java    From bazel with Apache License 2.0 4 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    markAsKept(MethodLinker.lastMember(programMethod));
}
 
Example #16
Source File: KeepMarker.java    From bazel with Apache License 2.0 4 votes vote down vote up
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
    markAsKept(MethodLinker.lastMember(libraryMethod));
}
 
Example #17
Source File: MethodOptimizationInfo.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public static MethodOptimizationInfo getMethodOptimizationInfo(Method method)
{
    return (MethodOptimizationInfo)MethodLinker.lastMember(method).getProcessingInfo();
}
 
Example #18
Source File: MemberObfuscator.java    From java-n-IDE-for-Android with 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 File: MemberObfuscator.java    From java-n-IDE-for-Android with 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();
}