org.apache.bcel.classfile.Method - java examples

Here are the examples of the java api org.apache.bcel.classfile.Method taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get ConstantDataflow for method.
 *
 * @param method
 *            the method
 * @return the ConstantDataflow
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public ConstantDataflow getConstantDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(ConstantDataflow.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get a UsagesRequiringNonNullValues for given method.
 *
 * @param method
 *            the method
 * @return the UsagesRequiringNonNullValues
 */
public UsagesRequiringNonNullValues getUsagesRequiringNonNullValues(Method method) throws DataflowreplacedysisException, CFGBuilderException {
    return getMethodreplacedysis(UsagesRequiringNonNullValues.clreplaced, method);
}

19 View Complete Implementation : DontIgnoreResultOfPutIfAbsent.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visitClreplacedContext(ClreplacedContext clreplacedContext) {
    JavaClreplaced javaClreplaced = clreplacedContext.getJavaClreplaced();
    ConstantPool pool = javaClreplaced.getConstantPool();
    boolean found = false;
    for (Constant constantEntry : pool.getConstantPool()) {
        if (constantEntry instanceof ConstantNameAndType) {
            ConstantNameAndType nt = (ConstantNameAndType) constantEntry;
            if ("putIfAbsent".equals(nt.getName(pool))) {
                found = true;
                break;
            }
        }
    }
    if (!found) {
        return;
    }
    Method[] methodList = javaClreplaced.getMethods();
    for (Method method : methodList) {
        MethodGen methodGen = clreplacedContext.getMethodGen(method);
        if (methodGen == null) {
            continue;
        }
        try {
            replacedyzeMethod(clreplacedContext, method);
        } catch (DataflowreplacedysisException e) {
            bugReporter.logError("Error replacedyzing " + method.toString(), e);
        } catch (CFGBuilderException e) {
            bugReporter.logError("Error replacedyzing " + method.toString(), e);
        }
    }
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get CallListDataflow for method.
 *
 * @param method
 *            the method
 * @return the CallListDataflow
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public CallListDataflow getCallListDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(CallListDataflow.clreplaced, method);
}

19 View Complete Implementation : InvalidJUnitTest.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visit(Method obj) {
    if (getMethodName().equals("suite") && !obj.isStatic()) {
        bugReporter.reportBug(new BugInstance(this, "IJU_SUITE_NOT_STATIC", NORMAL_PRIORITY).addClreplacedAndMethod(this));
    }
    if (getMethodName().equals("suite") && obj.getSignature().startsWith("()") && obj.isStatic()) {
        if ((!obj.getSignature().equals("()Ljunit/framework/Test;") && !obj.getSignature().equals("()Ljunit/framework/TestSuite;")) || !obj.isPublic()) {
            bugReporter.reportBug(new BugInstance(this, "IJU_BAD_SUITE_METHOD", NORMAL_PRIORITY).addClreplacedAndMethod(this));
        }
    }
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get dataflow for Lockreplacedysis for given method.
 *
 * @param method
 *            the method
 * @return the LockDataflow
 */
public LockDataflow getLockDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(LockDataflow.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get LiveLocalStorereplacedysis dataflow for given method.
 *
 * @param method
 *            the method
 * @return the Dataflow object for LiveLocalStorereplacedysis on the method
 */
public LiveLocalStoreDataflow getLiveLocalStoreDataflow(Method method) throws DataflowreplacedysisException, CFGBuilderException {
    return getMethodreplacedysis(LiveLocalStoreDataflow.clreplaced, method);
}

19 View Complete Implementation : Hierarchy.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@CheckForNull
public static JavaClreplacedAndMethod findMethod(JavaClreplaced javaClreplaced, String methodName, String methodSig, JavaClreplacedAndMethodChooser chooser) {
    if (DEBUG_METHOD_LOOKUP) {
        System.out.println("Check " + javaClreplaced.getClreplacedName());
    }
    Method[] methodList = javaClreplaced.getMethods();
    for (Method method : methodList) {
        if (method.getName().equals(methodName) && method.getSignature().equals(methodSig)) {
            JavaClreplacedAndMethod m = new JavaClreplacedAndMethod(javaClreplaced, method);
            if (chooser.choose(m)) {
                if (DEBUG_METHOD_LOOKUP) {
                    System.out.println("\t==> FOUND: " + method);
                }
                return m;
            }
        }
    }
    if (DEBUG_METHOD_LOOKUP) {
        System.out.println("\t==> NOT FOUND");
    }
    return null;
}

19 View Complete Implementation : SourceLineAnnotation.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Create from Method and Location in a visited clreplaced.
 *
 * @param clreplacedContext
 *            ClreplacedContext of visited clreplaced
 * @param method
 *            Method in visited clreplaced
 * @param loc
 *            Location in visited clreplaced
 * @return SourceLineAnnotation describing visited Location
 */
public static SourceLineAnnotation fromVisitedInstruction(ClreplacedContext clreplacedContext, Method method, Location loc) {
    return fromVisitedInstruction(clreplacedContext, method, loc.getHandle());
}

19 View Complete Implementation : FindReturnRef.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visit(Method obj) {
    check = publicClreplaced && (obj.getAccessFlags() & (Const.ACC_PUBLIC)) != 0;
    if (!check) {
        return;
    }
    staticMethod = (obj.getAccessFlags() & (Const.ACC_STATIC)) != 0;
    // variableNames = obj.getLocalVariableTable();
    parameterCount = getNumberMethodArguments();
    if (!staticMethod) {
        parameterCount++;
    }
    thisOnTOS = false;
    fieldOnTOS = false;
    super.visit(obj);
    thisOnTOS = false;
    fieldOnTOS = false;
}

19 View Complete Implementation : MemberUtils.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Checks if the method could be a lambda. Notice this is a best-check,
 * since once compiled lambda methods are not univocally distinguishable.
 *
 * @param m The method to check if it's a lambda
 * @return True if this could be a lambda, false otherwise
 */
public static boolean couldBeLambda(final Method m) {
    return m.isPrivate() && internalIsSynthetic(m);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
public static void dumpDataflowInformation(Method method, CFG cfg, ValueNumberDataflow vnd, IsNullValueDataflow inv, @CheckForNull UnconditionalValueDerefDataflow dataflow, @CheckForNull TypeDataflow typeDataflow) throws DataflowreplacedysisException {
    System.out.println("\n\n{ UnconditionalValueDerefreplacedysis replacedysis for " + method.getName());
    TreeSet<Location> tree = new TreeSet<>();
    for (Iterator<Location> locs = cfg.locationIterator(); locs.hasNext(); ) {
        Location loc = locs.next();
        tree.add(loc);
    }
    for (Location loc : tree) {
        System.out.println();
        if (dataflow != null) {
            System.out.println("\n Pre: " + dataflow.getFactAfterLocation(loc));
        }
        System.out.println("Vna: " + vnd.getFactAtLocation(loc));
        System.out.println("inv: " + inv.getFactAtLocation(loc));
        if (typeDataflow != null) {
            System.out.println("type: " + typeDataflow.getFactAtLocation(loc));
        }
        System.out.println("Location: " + loc);
        if (dataflow != null) {
            System.out.println("Post: " + dataflow.getFactAtLocation(loc));
        }
        System.out.println("Vna: " + vnd.getFactAfterLocation(loc));
        System.out.println("inv: " + inv.getFactAfterLocation(loc));
        if (typeDataflow != null) {
            System.out.println("type: " + typeDataflow.getFactAfterLocation(loc));
        }
    }
    System.out.println("}\n\n");
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get a CFG for given method. If pruning options are in effect, pruning
 * will be done. Because the CFG pruning can involve interprocedural
 * replacedysis, it is done on a best-effort basis, so the CFG returned might
 * not actually be pruned.
 *
 * @param method
 *            the method
 * @return the CFG
 * @throws CFGBuilderException
 *             if a CFG cannot be constructed for the method
 */
public CFG getCFG(Method method) throws CFGBuilderException {
    return getMethodreplacedysisNoDataflowreplacedysisException(CFG.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get store dataflow.
 *
 * @param method
 *            the method
 * @return the StoreDataflow
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public StoreDataflow getStoreDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(StoreDataflow.clreplaced, method);
}

19 View Complete Implementation : SourceLineAnnotation.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
static SourceLineAnnotation getSourceAnnotationForClreplaced(String clreplacedName, String sourceFileName) {
    int lastLine = -1;
    int firstLine = Integer.MAX_VALUE;
    try {
        JavaClreplaced targetClreplaced = replacedysisContext.currentreplacedysisContext().lookupClreplaced(clreplacedName);
        for (Method m : targetClreplaced.getMethods()) {
            Code c = m.getCode();
            if (c != null) {
                LineNumberTable table = c.getLineNumberTable();
                if (table != null) {
                    for (LineNumber line : table.getLineNumberTable()) {
                        lastLine = Math.max(lastLine, line.getLineNumber());
                        firstLine = Math.min(firstLine, line.getLineNumber());
                    }
                }
            }
        }
    } catch (ClreplacedNotFoundException e) {
        replacedysisContext.reportMissingClreplaced(e);
    }
    if (firstLine < Integer.MAX_VALUE) {
        return new SourceLineAnnotation(clreplacedName, sourceFileName, firstLine, lastLine, -1, -1);
    }
    return SourceLineAnnotation.createUnknown(clreplacedName, sourceFileName);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get array mapping bytecode offsets to opcodes for given method. Array
 * elements containing zero are either not valid instruction offsets, or
 * contain a NOP instruction. (It is convenient not to distinguish these
 * cases.)
 *
 * @param method
 *            the method
 * @return map of bytecode offsets to opcodes, empty if the method has no
 *         code
 */
@Nonnull
public short[] getOffsetToOpcodeMap(Method method) {
    UnpackedCode unpackedCode = getMethodreplacedysisNoException(UnpackedCode.clreplaced, method);
    return unpackedCode == null ? new short[0] : unpackedCode.getOffsetToBytecodeMap();
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/*
     * ----------------------------------------------------------------------
     * Helper methods for getting an replacedysis object from the replacedysis cache.
     * ----------------------------------------------------------------------
     */
private <replacedysis> replacedysis getMethodreplacedysisNoException(Clreplaced<replacedysis> replacedysisClreplaced, Method method) {
    try {
        return getMethodreplacedysis(replacedysisClreplaced, method);
    } catch (CheckedreplacedysisException e) {
        IllegalStateException ise = new IllegalStateException("should not happen");
        ise.initCause(e);
        throw ise;
    }
}

19 View Complete Implementation : SourceLineAnnotation.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Create from Method and bytecode offset in a visited clreplaced.
 *
 * @param jclreplaced
 *            JavaClreplaced of visited clreplaced
 * @param method
 *            Method in visited clreplaced
 * @param pc
 *            bytecode offset in visited method
 * @return SourceLineAnnotation describing visited instruction
 */
public static SourceLineAnnotation fromVisitedInstruction(JavaClreplaced jclreplaced, Method method, int pc) {
    LineNumberTable lineNumberTable = method.getCode().getLineNumberTable();
    String clreplacedName = jclreplaced.getClreplacedName();
    String sourceFile = jclreplaced.getSourceFileName();
    if (lineNumberTable == null) {
        return createUnknown(clreplacedName, sourceFile, pc, pc);
    }
    int startLine = lineNumberTable.getSourceLine(pc);
    return new SourceLineAnnotation(clreplacedName, sourceFile, startLine, startLine, pc, pc);
}

19 View Complete Implementation : Lookup.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@CheckForNull
public static JavaClreplaced findSuperImplementor(JavaClreplaced clazz, String name, String signature, BugReporter bugReporter) {
    try {
        JavaClreplaced c = clazz;
        while (true) {
            c = c.getSuperClreplaced();
            if (c == null) {
                return null;
            }
            Method m = findImplementation(c, name, signature);
            if (m != null && !m.isAbstract()) {
                return c;
            }
        }
    } catch (ClreplacedNotFoundException e) {
        bugReporter.reportMissingClreplaced(e);
        return null;
    }
}

19 View Complete Implementation : FindSqlInjection.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
private Set<ValueNumber> getPreplacedthruParams(ValueNumberDataflow vnd, Method method, JavaClreplaced javaClreplaced) {
    XMethod xMethod = XFactory.createXMethod(javaClreplaced, method);
    Set<ValueNumber> preplacedthruParams = new HashSet<>();
    int[] p = preparedStatementMethods.get(xMethod);
    if (p != null) {
        for (int pNum : p) {
            preplacedthruParams.add(vnd.getreplacedysis().getEntryValueForParameter(pNum));
        }
    }
    p = executeMethods.get(xMethod);
    if (p != null) {
        for (int pNum : p) {
            preplacedthruParams.add(vnd.getreplacedysis().getEntryValueForParameter(pNum));
        }
    }
    return preplacedthruParams;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get a TypeDataflow for given method.
 *
 * @param method
 *            the method
 * @return the TypeDataflow
 */
public TypeDataflow getTypeDataflow(Method method) throws DataflowreplacedysisException, CFGBuilderException {
    return getMethodreplacedysis(TypeDataflow.clreplaced, method);
}

19 View Complete Implementation : CallGraphNode.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
public clreplaced CallGraphNode extends AbstractVertex<CallGraphEdge, CallGraphNode> {

    private Method method;

    void setMethod(Method method) {
        this.method = method;
    }

    public Method getMethod() {
        return method;
    }
}

19 View Complete Implementation : UselessSubclassMethod.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
// TODO awaiting https://github.com/spotbugs/spotbugs/issues/626
@SuppressWarnings("PMD.SimplifyBooleanReturns")
private boolean differentAttributes(Method m1, Method m2) {
    if (m1.getAnnotationEntries().length > 0 || m2.getAnnotationEntries().length > 0) {
        return true;
    }
    int access1 = m1.getAccessFlags() & (Const.ACC_PRIVATE | Const.ACC_PROTECTED | Const.ACC_PUBLIC | Const.ACC_FINAL);
    int access2 = m2.getAccessFlags() & (Const.ACC_PRIVATE | Const.ACC_PROTECTED | Const.ACC_PUBLIC | Const.ACC_FINAL);
    m1.getAnnotationEntries();
    if (access1 != access2) {
        return true;
    }
    if (!thrownExceptions(m1).equals(thrownExceptions(m2))) {
        return false;
    }
    return false;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get array of type signatures of parameters for given method.
 *
 * @param method
 *            the method
 * @return an array of type signatures indicating the types of the method's
 *         parameters
 */
public String[] getParameterSignatureList(Method method) {
    return getMethodreplacedysisNoException(String[].clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get Dominatorsreplacedysis for given method, where implicit exception edges
 * are ignored.
 *
 * @param method
 *            the method
 * @return the Dominatorsreplacedysis
 */
public PostDominatorsreplacedysis getNonImplicitExceptionDominatorsreplacedysis(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(NonImplicitExceptionPostDominatorsreplacedysis.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * 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 replacedysis, 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(JavaClreplaced 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;
}

19 View Complete Implementation : InfiniteRecursiveLoop.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visit(Method obj) {
    seenTransferOfControl = false;
    seenStateChange = false;
    seenReturn = false;
    // seenThrow = false;
    largestBranchTarget = -1;
    if (DEBUG) {
        System.out.println();
        System.out.println(" --- " + getFullyQualifiedMethodName());
        System.out.println();
    }
}

19 View Complete Implementation : DuplicateBranches.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
private byte[] getCodeBytes(Method m, int start, int end) {
    byte[] code = m.getCode().getCode();
    byte[] bytes = new byte[end - start];
    System.arraycopy(code, start, bytes, 0, end - start);
    try {
        ByteSequence sequence = new ByteSequence(code);
        while ((sequence.available() > 0) && (sequence.getIndex() < start)) {
            Instruction.readInstruction(sequence);
        }
        int pos;
        while (sequence.available() > 0 && ((pos = sequence.getIndex()) < end)) {
            Instruction ins = Instruction.readInstruction(sequence);
            if ((ins instanceof BranchInstruction) && !(ins instanceof TABLESWITCH) && !(ins instanceof LOOKUPSWITCH)) {
                BranchInstruction bi = (BranchInstruction) ins;
                int offset = bi.getIndex();
                int target = offset + pos;
                if (target >= end) {
                    // or target < start ??
                    byte hiByte = (byte) ((target >> 8) & 0x000000FF);
                    byte loByte = (byte) (target & 0x000000FF);
                    bytes[pos + bi.getLength() - 2 - start] = hiByte;
                    bytes[pos + bi.getLength() - 1 - start] = loByte;
                }
            }
        }
    } catch (IOException ioe) {
    }
    return bytes;
}

19 View Complete Implementation : NoiseNullDeref.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visitClreplacedContext(ClreplacedContext clreplacedContext) {
    this.clreplacedContext = clreplacedContext;
    String currentMethod = null;
    JavaClreplaced jclreplaced = clreplacedContext.getJavaClreplaced();
    String clreplacedName = jclreplaced.getClreplacedName();
    String superClreplacedName = jclreplaced.getSuperclreplacedName();
    if (superClreplacedName.endsWith("ProtocolMessage")) {
        return;
    }
    if (CLreplaced != null && !clreplacedName.equals(CLreplaced)) {
        return;
    }
    Method[] methodList = jclreplaced.getMethods();
    for (Method method : methodList) {
        try {
            if (method.isAbstract() || method.isNative() || method.getCode() == null) {
                continue;
            }
            currentMethod = SignatureConverter.convertMethodSignature(jclreplaced, method);
            if (METHOD_NAME != null && !method.getName().equals(METHOD_NAME)) {
                continue;
            }
            if (DEBUG || DEBUG_NULLARG) {
                System.out.println("Checking for NP in " + currentMethod);
            }
            replacedyzeMethod(clreplacedContext, method);
        } catch (MissingClreplacedException e) {
            bugReporter.reportMissingClreplaced(e.getClreplacedNotFoundException());
        } catch (DataflowreplacedysisException e) {
            bugReporter.logError("While replacedyzing " + currentMethod + ": FindNullDeref caught dae exception", e);
        } catch (CFGBuilderException e) {
            bugReporter.logError("While replacedyzing " + currentMethod + ": FindNullDeref caught cfgb exception", e);
        }
        bugAcreplacedulator.reportAcreplacedulatedBugs();
    }
}

19 View Complete Implementation : Lookup.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@CheckForNull
public static XMethod findSuperImplementorAsXMethod(JavaClreplaced clazz, String name, String signature, BugReporter bugReporter) {
    try {
        JavaClreplaced c = clazz;
        while (true) {
            c = c.getSuperClreplaced();
            if (c == null) {
                return null;
            }
            Method m = findImplementation(c, name, signature);
            if (m != null && !m.isAbstract()) {
                return XFactory.createXMethod(c, m);
            }
        }
    } catch (ClreplacedNotFoundException e) {
        bugReporter.reportMissingClreplaced(e);
        return null;
    }
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get LockChecker for method. This is like LockDataflow, but may be able to
 * avoid performing the actual dataflow replacedyses if the method doesn't
 * contain explicit monitorenter/monitorexit instructions.
 *
 * @param method
 *            the method
 * @return the LockChecker
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public LockChecker getLockChecker(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(LockChecker.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Nonnull
static public Set<Integer> getLoopExitBranches(Method method, MethodGen methodGen) {
    XMethod xmethod = XFactory.createXMethod(methodGen);
    if (cachedLoopExits().containsKey(xmethod)) {
        Set<Integer> result = cachedLoopExits().get(xmethod);
        if (result == null) {
            replacedysisContext.logError("Null cachedLoopExits for " + xmethod, new NullPointerException());
            replacedert false;
            return Collections.<Integer>emptySet();
        }
        return result;
    }
    Code code = method.getCode();
    if (code == null) {
        replacedert false;
        return Collections.<Integer>emptySet();
    }
    byte[] instructionList = code.getCode();
    Set<Integer> result = new HashSet<>();
    for (int i = 0; i < instructionList.length; i++) {
        if (checkForBranchExit(instructionList, i)) {
            result.add(i);
        }
    }
    if (result.size() == 0) {
        result = Collections.<Integer>emptySet();
    }
    cachedLoopExits().put(xmethod, result);
    return result;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get Dominatorsreplacedysis for given method, where exception edges are
 * ignored.
 *
 * @param method
 *            the method
 * @return the Dominatorsreplacedysis
 */
public Dominatorsreplacedysis getNonExceptionDominatorsreplacedysis(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(Dominatorsreplacedysis.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
public static void dumpTypeDataflow(Method method, CFG cfg, TypeDataflow typeDataflow) throws DataflowreplacedysisException {
    System.out.println("\n\n{ Type replacedysis for " + cfg.getMethodGen().getClreplacedName() + "." + method.getName() + method.getSignature());
    TreeSet<Location> tree = new TreeSet<>();
    for (Iterator<Location> locs = cfg.locationIterator(); locs.hasNext(); ) {
        Location loc = locs.next();
        tree.add(loc);
    }
    for (Location loc : tree) {
        System.out.println("\n Pre: " + typeDataflow.getFactAtLocation(loc));
        System.out.println("Location: " + loc);
        System.out.println("Post: " + typeDataflow.getFactAfterLocation(loc));
    }
    System.out.println("}\n\n");
}

19 View Complete Implementation : UnconditionalValueDerefAnalysis.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
public static Set<ValueNumber> checkAllNonNullParams(Location location, ValueNumberFrame vnaFrame, ConstantPoolGen constantPool, @CheckForNull Method method, @CheckForNull IsNullValueDataflow invDataflow, TypeDataflow typeDataflow) throws DataflowreplacedysisException {
    IsNullValueFrame invFrame = null;
    if (invDataflow != null) {
        invFrame = invDataflow.getFactAtLocation(location);
    }
    Set<ValueNumber> result1 = checkNonNullParams(location, vnaFrame, constantPool, method, invFrame);
    Set<ValueNumber> result2 = checkUnconditionalDerefDatabase(location, vnaFrame, constantPool, invFrame, typeDataflow);
    if (result1.isEmpty()) {
        return result2;
    }
    if (result2.isEmpty()) {
        return result1;
    }
    result1.addAll(result2);
    return result1;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get the UnconditionalValueDerefDataflow for a method.
 *
 * @param method
 *            the method
 * @return the UnconditionalValueDerefDataflow
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public UnconditionalValueDerefDataflow getUnconditionalValueDerefDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(UnconditionalValueDerefDataflow.clreplaced, method);
}

19 View Complete Implementation : FindSqlInjection.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visitClreplacedContext(ClreplacedContext clreplacedContext) {
    JavaClreplaced javaClreplaced = clreplacedContext.getJavaClreplaced();
    if (!PreorderVisitor.hasInterestingMethod(javaClreplaced.getConstantPool(), allMethods)) {
        return;
    }
    Method[] methodList = javaClreplaced.getMethods();
    for (Method method : methodList) {
        MethodGen methodGen = clreplacedContext.getMethodGen(method);
        if (methodGen == null) {
            continue;
        }
        try {
            replacedyzeMethod(clreplacedContext, method);
        } catch (DataflowreplacedysisException e) {
            bugReporter.logError("FindSqlInjection caught exception while replacedyzing " + clreplacedContext.getFullyQualifiedMethodName(method), e);
        } catch (CFGBuilderException e) {
            bugReporter.logError("FindSqlInjection caught exception while replacedyzing " + clreplacedContext.getFullyQualifiedMethodName(method), e);
        } catch (RuntimeException e) {
            bugReporter.logError("FindSqlInjection caught exception while replacedyzing " + clreplacedContext.getFullyQualifiedMethodName(method), e);
        }
    }
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get ReturnPathTypeDataflow for a method.
 *
 * @param method
 *            the method
 * @return the ReturnPathTypeDataflow for the method
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public ReturnPathTypeDataflow getReturnPathTypeDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(ReturnPathTypeDataflow.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get load dataflow.
 *
 * @param method
 *            the method
 * @return the LoadDataflow
 * @throws CFGBuilderException
 * @throws DataflowreplacedysisException
 */
public LoadDataflow getLoadDataflow(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(LoadDataflow.clreplaced, method);
}

19 View Complete Implementation : UncallableMethodOfAnonymousClass.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visit(Method obj) {
    try {
        if (skip(obj)) {
            return;
        }
        JavaClreplaced clazz = getThisClreplaced();
        XMethod xmethod = XFactory.createXMethod(clazz, obj);
        XFactory factory = replacedysisContext.currentXFactory();
        String key = obj.getName() + ":" + obj.getSignature();
        if (!factory.isCalled(xmethod) && (obj.isStatic() || !definedInSuperClreplacedOrInterface(clazz, key))) {
            int priority = NORMAL_PRIORITY;
            JavaClreplaced superClreplaced = clazz.getSuperClreplaced();
            String superClreplacedName = superClreplaced.getClreplacedName();
            if (Values.DOTTED_JAVA_LANG_OBJECT.equals(superClreplacedName)) {
                priority = NORMAL_PRIORITY;
            } else if (definedInClreplaced(superClreplaced).containsAll(definedInClreplaced(clazz))) {
                priority = NORMAL_PRIORITY;
            } else {
                priority = HIGH_PRIORITY;
            }
            Code code = null;
            for (Attribute a : obj.getAttributes()) {
                if (a instanceof Code) {
                    code = (Code) a;
                    break;
                }
            }
            if (code != null && code.getLength() == 1) {
                priority++;
            }
            pendingBug = new BugInstance(this, "UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLreplaced", priority).addClreplacedAndMethod(this);
            potentialSuperCall = null;
        }
    } catch (ClreplacedNotFoundException e) {
        bugReporter.reportMissingClreplaced(e);
    }
}

19 View Complete Implementation : DuplicateBranches.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
private BigInteger getCodeBytesAsBigInt(Method method, int[] switchPos, int i, int endPos) {
    byte[] clause = getCodeBytes(method, switchPos[i], endPos);
    BigInteger clauseAsInt;
    if (clause.length == 0) {
        clauseAsInt = BigInteger.ZERO;
    } else {
        clauseAsInt = new BigInteger(clause);
    }
    return clauseAsInt;
}

19 View Complete Implementation : StringConcatenation.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
@Override
public void visit(Method obj) {
    if (DEBUG) {
        System.out.println("------------------- replacedyzing " + obj.getName() + " ----------------");
    }
    reset();
    clobberedRegisters = new HashMap<>();
    reportedThisMethod = false;
    super.visit(obj);
}

19 View Complete Implementation : XFactory.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Create an XMethod object from a BCEL Method.
 *
 * @param javaClreplaced
 *            the clreplaced to which the Method belongs
 * @param method
 *            the Method
 * @return an XMethod representing the Method
 */
public static XMethod createXMethod(JavaClreplaced javaClreplaced, Method method) {
    if (method == null) {
        throw new NullPointerException("method must not be null");
    }
    XMethod xmethod = createXMethod(javaClreplaced.getClreplacedName(), method);
    replacedert xmethod.isResolved();
    return xmethod;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get ExceptionSetFactory for given method.
 *
 * @param method
 *            the method
 * @return the ExceptionSetFactory
 */
public ExceptionSetFactory getExceptionSetFactory(Method method) {
    return getMethodreplacedysisNoException(ExceptionSetFactory.clreplaced, method);
}

19 View Complete Implementation : Hierarchy.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Find a method in given clreplaced.
 *
 * @param javaClreplaced
 *            the clreplaced
 * @param methodName
 *            the name of the method
 * @param methodSig
 *            the signature of the method
 * @return the JavaClreplacedAndMethod, or null if no such method exists in the
 *         clreplaced
 */
@Deprecated
@CheckForNull
public static JavaClreplacedAndMethod findConcreteMethod(JavaClreplaced javaClreplaced, String methodName, String methodSig) {
    if (DEBUG_METHOD_LOOKUP) {
        System.out.println("Check " + javaClreplaced.getClreplacedName());
    }
    Method[] methodList = javaClreplaced.getMethods();
    for (Method method : methodList) {
        if (method.getName().equals(methodName) && method.getSignature().equals(methodSig) && accessFlagsAreConcrete(method.getAccessFlags())) {
            JavaClreplacedAndMethod m = new JavaClreplacedAndMethod(javaClreplaced, method);
            return m;
        }
    }
    if (DEBUG_METHOD_LOOKUP) {
        System.out.println("\t==> NOT FOUND");
    }
    return null;
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get PostDominatorsreplacedysis for given method, where exception edges are
 * ignored.
 *
 * @param method
 *            the method
 * @return the PostDominatorsreplacedysis
 */
public PostDominatorsreplacedysis getNonExceptionPostDominatorsreplacedysis(Method method) throws CFGBuilderException, DataflowreplacedysisException {
    return getMethodreplacedysis(NonExceptionPostdominatorsreplacedysis.clreplaced, method);
}

19 View Complete Implementation : ClassContext.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get a CompactLocationNumbering for a method.
 *
 * @param method
 *            a method
 * @return the CompactLocationNumbering for the method
 * @throws CFGBuilderException
 */
public CompactLocationNumbering getCompactLocationNumbering(Method method) throws CFGBuilderException {
    return getMethodreplacedysisNoDataflowreplacedysisException(CompactLocationNumbering.clreplaced, method);
}

19 View Complete Implementation : InvalidJUnitTest.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
private boolean hasTestMethods(JavaClreplaced jClreplaced) {
    boolean foundTest = false;
    Method[] methods = jClreplaced.getMethods();
    for (Method m : methods) {
        if (m.isPublic() && m.getName().startsWith("test") && m.getSignature().equals("()V")) {
            return true;
        }
        if (m.getName().startsWith("runTest") && m.getSignature().endsWith("()V")) {
            return true;
        }
    }
    if (hreplaceduite(methods)) {
        return true;
    }
    try {
        JavaClreplaced sClreplaced = jClreplaced.getSuperClreplaced();
        if (sClreplaced != null) {
            return hasTestMethods(sClreplaced);
        }
    } catch (ClreplacedNotFoundException e) {
        replacedysisContext.reportMissingClreplaced(e);
    }
    return false;
}

19 View Complete Implementation : UncallableMethodOfAnonymousClass.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
boolean definedInThisClreplacedOrSuper(JavaClreplaced clazz, String method) throws ClreplacedNotFoundException {
    if (clazz == null) {
        return false;
    }
    // System.out.println("Checking to see if " + method + " is defined in "
    // + clazz.getClreplacedName());
    for (Method m : clazz.getMethods()) {
        String key = m.getName() + ":" + m.getSignature();
        if (!m.isStatic() && method.equals(key)) {
            return true;
        }
    }
    return definedInSuperClreplacedOrInterface(clazz, method);
}

19 View Complete Implementation : LocalVariableAnnotation.java
Copyright GNU Lesser General Public License v2.1
Author : spotbugs
/**
 * Get a local variable annotation describing a parameter.
 *
 * @param method
 *            a Method
 * @param local
 *            the local variable containing the parameter
 * @return LocalVariableAnnotation describing the parameter
 */
public static LocalVariableAnnotation getParameterLocalVariableAnnotation(Method method, int local) {
    LocalVariableAnnotation lva = getLocalVariableAnnotation(method, local, 0, 0);
    if (lva.isNamed()) {
        lva.setDescription(LocalVariableAnnotation.PARAMETER_NAMED_ROLE);
    } else {
        lva.setDescription(LocalVariableAnnotation.PARAMETER_ROLE);
    }
    return lva;
}