当前位置: 首页>>代码示例>>Java>>正文


Java ClassReader.SKIP_FRAMES属性代码示例

本文整理汇总了Java中org.objectweb.asm.ClassReader.SKIP_FRAMES属性的典型用法代码示例。如果您正苦于以下问题:Java ClassReader.SKIP_FRAMES属性的具体用法?Java ClassReader.SKIP_FRAMES怎么用?Java ClassReader.SKIP_FRAMES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.objectweb.asm.ClassReader的用法示例。


在下文中一共展示了ClassReader.SKIP_FRAMES属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

private void update() {
	int in = 0;
	int out = 0;
	if (inE.isSelected()) {
		in |= ClassReader.EXPAND_FRAMES;
	}
	if (inD.isSelected()) {
		in |= ClassReader.SKIP_DEBUG;
	}
	if (inF.isSelected()) {
		in |= ClassReader.SKIP_FRAMES;
	}
	if (inC.isSelected()) {
		in |= ClassReader.SKIP_CODE;
	}
	if (outF.isSelected()) {
		out |= ClassWriter.COMPUTE_FRAMES;
	}
	if (outM.isSelected()) {
		out |= ClassWriter.COMPUTE_MAXS;
	}
	getOptions().classFlagsInput = in;
	getOptions().classFlagsOutput = out;
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:24,代码来源:AsmFlagsPanel.java

示例2: transformBytes

/**
 * Get the raw bytes of instrumented class with name {@code className}
 *
 * @param classLoader
 * @param className
 * @param reader
 * @return
 */
public byte[] transformBytes(ClassLoader classLoader, ClassName className, ClassReader reader) {
    Objects.requireNonNull(classLoader);
    Objects.requireNonNull(className);
    Objects.requireNonNull(reader);

    if (!canInstrumentForCoverage(className)) {
        throw new IllegalArgumentException("Cannot instrument " + className);
    }


    int asmFlags = ClassWriter.COMPUTE_FRAMES;
    ClassWriter writer = new ComputeClassWriter(asmFlags);
    ClassVisitor cv = writer;

    //this is very we hook our instrumentation
    cv = new CoverageClassVisitor(cv, className);

    //avoid reading frames, as we re-compute them
    int readFlags = ClassReader.SKIP_FRAMES;

    /*
        This is using the "Visitor Pattern".
        In a nutshell, we scan the whole class definition, and at each
        element we "print" in the "writer" buffer.
        On such buffer we also add our instrumentation.
        Then, once we are done traversing the "reader", we convert
        the buffer in the "writer" into byte[] data
     */
    reader.accept(cv, readFlags);

    return writer.toByteArray();
}
 
开发者ID:arcuri82,项目名称:testing_security_development_enterprise_systems,代码行数:40,代码来源:Instrumentator.java

示例3: transformBytes

/**
 * Get the raw bytes of instrumented class with name {@code className}
 *
 * @param classLoader
 * @param className
 * @param reader
 * @return
 */
public byte[] transformBytes(ClassLoader classLoader, ClassName className, ClassReader reader) {
    Objects.requireNonNull(classLoader);
    Objects.requireNonNull(className);
    Objects.requireNonNull(reader);

    if (!ClassesToExclude.checkIfCanInstrument(className)) {
        throw new IllegalArgumentException("Cannot instrument " + className);
    }


    int asmFlags = ClassWriter.COMPUTE_FRAMES;
    ClassWriter writer = new ComputeClassWriter(asmFlags);
    ClassVisitor cv = writer;

    //avoid reading frames, as we re-compute them
    int readFlags = ClassReader.SKIP_FRAMES;

    if(canInstrumentForCoverage(className)){

        ClassNode cn = new ClassNode();
        reader.accept(cn, readFlags);
        ReplacementList.getBooleanMethodTransformers()
                .forEach(t -> t.transformClass(cn));

        cv = new CoverageClassVisitor(cv, className);

        cn.accept(cv);

    } else {
        /*
            For "now" we only instrument classes that will directly
            contribute to coverage, ie the SUT.
            In the future, likely also to instrument other third-party
            library classes for testability transformations
         */

        reader.accept(cv, readFlags);
    }

    return writer.toByteArray();
}
 
开发者ID:EMResearch,项目名称:EvoMaster,代码行数:49,代码来源:Instrumentator.java


注:本文中的org.objectweb.asm.ClassReader.SKIP_FRAMES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。