Java Code Examples for proguard.classfile.Clazz#getClassName()

The following examples show how to use proguard.classfile.Clazz#getClassName() . 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: ClassReferenceFixer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo)
{
    // Fix the inner class name.
    int innerClassIndex = innerClassesInfo.u2innerClassIndex;
    int innerNameIndex  = innerClassesInfo.u2innerNameIndex;
    if (innerClassIndex != 0 &&
        innerNameIndex  != 0)
    {
        String newInnerName = clazz.getClassName(innerClassIndex);
        int index = newInnerName.lastIndexOf(ClassConstants.INTERNAL_INNER_CLASS_SEPARATOR);
        if (index >= 0)
        {
            innerClassesInfo.u2innerNameIndex =
                new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newInnerName.substring(index + 1));
        }
    }
}
 
Example 2
Source File: ClassObfuscator.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo)
{
    // Make sure the outer class has a name, if it exists.
    int innerClassIndex = innerClassesInfo.u2innerClassIndex;
    int outerClassIndex = innerClassesInfo.u2outerClassIndex;
    if (innerClassIndex != 0 &&
        outerClassIndex != 0)
    {
        String innerClassName = clazz.getClassName(innerClassIndex);
        if (innerClassName.equals(clazz.getName()))
        {
            clazz.constantPoolEntryAccept(outerClassIndex, this);

            String outerClassName = clazz.getClassName(outerClassIndex);

            numericClassName = isNumericClassName(innerClassName,
                                                  outerClassName);
        }
    }
}
 
Example 3
Source File: ClassObfuscator.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute)
{
    // Make sure the enclosing class has a name.
    enclosingMethodAttribute.referencedClassAccept(this);

    String innerClassName = clazz.getName();
    String outerClassName = clazz.getClassName(enclosingMethodAttribute.u2classIndex);

    numericClassName = isNumericClassName(innerClassName,
                                          outerClassName);
}
 
Example 4
Source File: RefConstant.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the class name.
 */
public String getClassName(Clazz clazz)
{
    return clazz.getClassName(u2classIndex);
}
 
Example 5
Source File: EnclosingMethodAttribute.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the class name.
 */
public String getClassName(Clazz clazz)
{
    return clazz.getClassName(u2classIndex);
}
 
Example 6
Source File: PartialEvaluator.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
    {
        int startPC = exceptionInfo.u2startPC;
        int endPC   = exceptionInfo.u2endPC;

        // Do we have to evaluate this exception catch block?
        if (isTraced(startPC, endPC))
        {
            int handlerPC = exceptionInfo.u2handlerPC;
            int catchType = exceptionInfo.u2catchType;

            if (DEBUG) System.out.println("Evaluating exception ["+startPC +" -> "+endPC +": "+handlerPC+"]:");

            // Reuse the existing variables and stack objects, ensuring the
            // right size.
            TracedVariables variables = new TracedVariables(codeAttribute.u2maxLocals);
            TracedStack     stack     = new TracedStack(codeAttribute.u2maxStack);

            // Initialize the trace values.
            Value storeValue = new InstructionOffsetValue(AT_CATCH_ENTRY);
            variables.setProducerValue(storeValue);
            stack.setProducerValue(storeValue);

            // Initialize the variables by generalizing the variables of the
            // try block. Make sure to include the results of the last
            // instruction for preverification.
            generalizeVariables(startPC,
                                endPC,
                                evaluateAllCode,
                                variables);

            // Initialize the the stack.
            //stack.push(valueFactory.createReference((ClassConstant)((ProgramClass)clazz).getConstant(exceptionInfo.u2catchType), false));
            String catchClassName = catchType != 0 ?
                 clazz.getClassName(catchType) :
                 ClassConstants.INTERNAL_NAME_JAVA_LANG_THROWABLE;

            Clazz catchClass = catchType != 0 ?
                ((ClassConstant)((ProgramClass)clazz).getConstant(catchType)).referencedClass :
                null;

            stack.push(valueFactory.createReferenceValue(catchClassName,
                                                         catchClass,
                                                         false));

            int evaluationCount = evaluationCounts[handlerPC];

            // Evaluate the instructions, starting at the entry point.
            evaluateInstructionBlock(clazz,
                                     method,
                                     codeAttribute,
                                     variables,
                                     stack,
                                     handlerPC);

            // Remember to evaluate all exception handlers once more.
            if (!evaluateExceptions)
            {
                evaluateExceptions = evaluationCount < evaluationCounts[handlerPC];
            }
        }
//        else if (evaluateAllCode)
//        {
//            if (DEBUG) System.out.println("No information for partial evaluation of exception ["+startPC +" -> "+endPC +": "+exceptionInfo.u2handlerPC+"] yet");
//
//            // We don't have any information on the try block yet, but we do
//            // have to evaluate the exception handler.
//            // Remember to evaluate all exception handlers once more.
//            evaluateExceptions = true;
//        }
        else
        {
            if (DEBUG) System.out.println("No information for partial evaluation of exception ["+startPC +" -> "+endPC +": "+exceptionInfo.u2handlerPC+"]");
        }
    }