當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。