本文整理汇总了Java中proguard.classfile.visitor.ClassPrinter类的典型用法代码示例。如果您正苦于以下问题:Java ClassPrinter类的具体用法?Java ClassPrinter怎么用?Java ClassPrinter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassPrinter类属于proguard.classfile.visitor包,在下文中一共展示了ClassPrinter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dump
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
/**
* Prints out the contents of the program classes.
*/
private void dump() throws IOException
{
if (configuration.verbose)
{
System.out.println("Printing classes to [" + fileName(configuration.dump) + "]...");
}
PrintStream ps = createPrintStream(configuration.dump);
try
{
programClassPool.classesAccept(new ClassPrinter(ps));
}
finally
{
closePrintStream(ps);
}
}
示例2: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// DEBUG =
// clazz.getName().equals("abc/Def") &&
// method.getName(clazz).equals("abc");
// TODO: Remove this when the subroutine inliner has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while inlining subroutines:");
System.err.println(" Class = ["+clazz.getName()+"]");
System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
if (DEBUG)
{
method.accept(clazz, new ClassPrinter());
}
throw ex;
}
}
示例3: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// DEBUG =
// clazz.getName().equals("abc/Def") &&
// method.getName(clazz).equals("abc");
// TODO: Remove this when the code has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while computing stack sizes:");
System.err.println(" Class = ["+clazz.getName()+"]");
System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
if (DEBUG)
{
method.accept(clazz, new ClassPrinter());
}
throw ex;
}
}
示例4: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// DEBUG = DEBUG_RESULTS =
// clazz.getName().equals("abc/Def") &&
// method.getName(clazz).equals("abc");
// TODO: Remove this when the evaluation shrinker has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while shrinking instructions after partial evaluation:");
System.err.println(" Class = ["+clazz.getName()+"]");
System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
System.err.println("Not optimizing this method");
if (DEBUG)
{
method.accept(clazz, new ClassPrinter());
throw ex;
}
}
}
示例5: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// DEBUG =
// clazz.getName().equals("abc/Def") &&
// method.getName(clazz).equals("abc");
// TODO: Remove this when the evaluation simplifier has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while simplifying instructions after partial evaluation:");
System.err.println(" Class = ["+clazz.getName()+"]");
System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
System.err.println("Not optimizing this method");
if (DEBUG)
{
method.accept(clazz, new ClassPrinter());
throw ex;
}
}
}
示例6: visitProgramClass
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitProgramClass(ProgramClass programClass)
{
//final String CLASS_NAME = "abc/Def";
//DEBUG = programClass.getName().equals(CLASS_NAME) ||
// targetClass.getName().equals(CLASS_NAME);
// TODO: Remove this when the class merger has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
visitProgramClass0(programClass);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while merging classes:");
System.err.println(" Class = ["+programClass.getName()+"]");
System.err.println(" Target class = ["+targetClass.getName()+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
if (DEBUG)
{
programClass.accept(new ClassPrinter());
targetClass.accept(new ClassPrinter());
}
throw ex;
}
}
示例7: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// TODO: Remove this when the method inliner has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while inlining method:");
System.err.println(" Target class = ["+targetClass.getName()+"]");
System.err.println(" Target method = ["+targetMethod.getName(targetClass)+targetMethod.getDescriptor(targetClass)+"]");
if (inlining)
{
System.err.println(" Inlined class = ["+clazz.getName()+"]");
System.err.println(" Inlined method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
}
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
System.err.println("Not inlining this method");
if (DEBUG)
{
targetMethod.accept(targetClass, new ClassPrinter());
if (inlining)
{
method.accept(clazz, new ClassPrinter());
}
throw ex;
}
}
}
示例8: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
// DEBUG = DEBUG_RESULTS =
// clazz.getName().equals("abc/Def") &&
// method.getName(clazz).equals("abc");
// TODO: Remove this when the partial evaluator has stabilized.
// Catch any unexpected exceptions from the actual visiting method.
try
{
// Process the code.
visitCodeAttribute0(clazz, method, codeAttribute);
}
catch (RuntimeException ex)
{
System.err.println("Unexpected error while performing partial evaluation:");
System.err.println(" Class = ["+clazz.getName()+"]");
System.err.println(" Method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
if (DEBUG)
{
method.accept(clazz, new ClassPrinter());
System.out.println("Evaluation results:");
int offset = 0;
do
{
if (isBranchOrExceptionTarget(offset))
{
System.out.println("Branch target from ["+branchOriginValues[offset]+"]:");
if (isTraced(offset))
{
System.out.println(" Vars: "+variablesBefore[offset]);
System.out.println(" Stack: "+stacksBefore[offset]);
}
}
Instruction instruction = InstructionFactory.create(codeAttribute.code,
offset);
System.out.println(instruction.toString(offset));
if (isTraced(offset))
{
int initializationOffset = branchTargetFinder.initializationOffset(offset);
if (initializationOffset != NONE)
{
System.out.println(" is to be initialized at ["+initializationOffset+"]");
}
InstructionOffsetValue branchTargets = branchTargets(offset);
if (branchTargets != null)
{
System.out.println(" has overall been branching to "+branchTargets);
}
System.out.println(" Vars: "+variablesAfter[offset]);
System.out.println(" Stack: "+stacksAfter[offset]);
}
offset += instruction.length(offset);
}
while (offset < codeAttribute.u4codeLength);
}
throw ex;
}
}
示例9: visitCodeAttribute
import proguard.classfile.visitor.ClassPrinter; //导入依赖的package包/类
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
if (DEBUG)
{
System.out.println("CodeAttributeComposer: putting results in ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"]");
}
if (level != -1)
{
throw new IllegalArgumentException("Code fragment not ended ["+level+"]");
}
level++;
// Make sure the code attribute has sufficient space for the composed
// code.
if (codeAttribute.u4codeLength < codeLength)
{
codeAttribute.code = new byte[codeLength];
}
// Copy the composed code over into the code attribute.
codeAttribute.u4codeLength = codeLength;
System.arraycopy(code, 0, codeAttribute.code, 0, codeLength);
// Remove exceptions with empty code blocks (done before).
//exceptionTableLength =
// removeEmptyExceptions(exceptionTable, exceptionTableLength);
// Make sure the exception table has sufficient space for the composed
// exceptions.
if (codeAttribute.exceptionTable.length < exceptionTableLength)
{
codeAttribute.exceptionTable = new ExceptionInfo[exceptionTableLength];
}
// Copy the exception table.
codeAttribute.u2exceptionTableLength = exceptionTableLength;
System.arraycopy(exceptionTable, 0, codeAttribute.exceptionTable, 0, exceptionTableLength);
// Update the maximum stack size and local variable frame size.
stackSizeUpdater.visitCodeAttribute(clazz, method, codeAttribute);
variableSizeUpdater.visitCodeAttribute(clazz, method, codeAttribute);
// Add a new line number table for the line numbers, if necessary.
if (lineNumberTableLength > 0 &&
codeAttribute.getAttribute(clazz, ClassConstants.ATTR_LineNumberTable) == null)
{
int attributeNameIndex =
new ConstantPoolEditor((ProgramClass)clazz)
.addUtf8Constant(ClassConstants.ATTR_LineNumberTable);
new AttributesEditor((ProgramClass)clazz, (ProgramMember)method, codeAttribute, false)
.addAttribute(new LineNumberTableAttribute(attributeNameIndex, 0, null));
}
// Copy the line number table and the local variable table.
codeAttribute.attributesAccept(clazz, method, this);
// Remap the exception table (done before).
//codeAttribute.exceptionsAccept(clazz, method, this);
// Remove exceptions with empty code blocks (done before).
//codeAttribute.u2exceptionTableLength =
// removeEmptyExceptions(codeAttribute.exceptionTable,
// codeAttribute.u2exceptionTableLength);
// Make sure instructions are widened if necessary.
instructionWriter.visitCodeAttribute(clazz, method, codeAttribute);
level--;
if (DEBUG)
{
codeAttribute.accept(clazz, method, new ClassPrinter());
}
}