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


Java UnpackedBytecodeCallback类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.classfile.engine.bcel.UnpackedBytecodeCallback的典型用法代码示例。如果您正苦于以下问题:Java UnpackedBytecodeCallback类的具体用法?Java UnpackedBytecodeCallback怎么用?Java UnpackedBytecodeCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnpackedBytecodeCallback类属于edu.umd.cs.findbugs.classfile.engine.bcel包,在下文中一共展示了UnpackedBytecodeCallback类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBytecodeSet

import edu.umd.cs.findbugs.classfile.engine.bcel.UnpackedBytecodeCallback; //导入依赖的package包/类
/**
 * Get a BitSet representing the bytecodes that are used in the given
 * method. This is useful for prescreening a method for the existence of
 * particular instructions. Because this step doesn't require building a
 * MethodGen, it is very fast and memory-efficient. It may allow a Detector
 * to avoid some very expensive analysis, which is a Big Win for the user.
 * 
 * @param method
 *            the method
 * @return the BitSet containing the opcodes which appear in the method, or
 *         null if the method has no code
 */
@CheckForNull
static public BitSet getBytecodeSet(JavaClass clazz, Method method) {

    XMethod xmethod = XFactory.createXMethod(clazz, method);
    if (cachedBitsets().containsKey(xmethod)) {
        return cachedBitsets().get(xmethod);
    }
    Code code = method.getCode();
    if (code == null)
        return null;

    byte[] instructionList = code.getCode();

    // Create callback
    UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length);

    // Scan the method.
    BytecodeScanner scanner = new BytecodeScanner();
    scanner.scan(instructionList, callback);

    UnpackedCode unpackedCode = callback.getUnpackedCode();
    BitSet result = null;
    if (unpackedCode != null)
        result = unpackedCode.getBytecodeSet();
    cachedBitsets().put(xmethod, result);
    return result;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:40,代码来源:ClassContext.java

示例2: getBytecodeSet

import edu.umd.cs.findbugs.classfile.engine.bcel.UnpackedBytecodeCallback; //导入依赖的package包/类
/**
 * Get a BitSet representing the bytecodes that are used in the given
 * method. This is useful for prescreening a method for the existence of
 * particular instructions. Because this step doesn't require building a
 * MethodGen, it is very fast and memory-efficient. It may allow a Detector
 * to avoid some very expensive analysis, which is a Big Win for the user.
 *
 * @param method
 *            the method
 * @return the BitSet containing the opcodes which appear in the method, or
 *         null if the method has no code
 */
@CheckForNull
static public BitSet getBytecodeSet(JavaClass clazz, Method method) {

    XMethod xmethod = XFactory.createXMethod(clazz, method);
    if (cachedBitsets().containsKey(xmethod)) {
        return cachedBitsets().get(xmethod);
    }
    Code code = method.getCode();
    if (code == null)
        return null;

    byte[] instructionList = code.getCode();

    // Create callback
    UnpackedBytecodeCallback callback = new UnpackedBytecodeCallback(instructionList.length);

    // Scan the method.
    BytecodeScanner scanner = new BytecodeScanner();
    scanner.scan(instructionList, callback);

    UnpackedCode unpackedCode = callback.getUnpackedCode();
    BitSet result = null;
    if (unpackedCode != null)
        result = unpackedCode.getBytecodeSet();
    cachedBitsets().put(xmethod, result);
    return result;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:40,代码来源:ClassContext.java


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