/** * Constructor. * * @param classContext * the ClassContext * @param method * the method to analyze * @param collector * the NullDerefAndRedundantComparisonCollector used to report * null derefs and redundant null comparisons */ public NullDerefAndRedundantComparisonFinder(ClassContext classContext, Method method, NullDerefAndRedundantComparisonCollector collector) { this.classContext = classContext; this.method = method; this.collector = collector; this.findGuaranteedDerefs = classContext.getAnalysisContext().getBoolProperty( AnalysisFeatures.TRACK_GUARANTEED_VALUE_DEREFS_IN_NULL_POINTER_ANALYSIS); this.lineMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); this.redundantBranchList = new LinkedList<>(); this.definitelySameBranchSet = new BitSet(); this.definitelyDifferentBranchSet = new BitSet(); this.undeterminedBranchSet = new BitSet(); this.assertionMethods = classContext.getAssertionMethods(); }
private boolean uniqueLocations(Collection<Location> derefLocationSet) { boolean uniqueDereferenceLocations = false; LineNumberTable table = method.getLineNumberTable(); if (table == null) { uniqueDereferenceLocations = true; } else { BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); for (Location loc : derefLocationSet) { int lineNumber = table.getSourceLine(loc.getHandle().getPosition()); if (!linesMentionedMultipleTimes.get(lineNumber)) { uniqueDereferenceLocations = true; } } } return uniqueDereferenceLocations; }
private boolean uniqueLocations(Collection<Location> derefLocationSet) { boolean uniqueDereferenceLocations = false; CodeException[] exceptionTable = method.getCode().getExceptionTable(); if (exceptionTable == null) { return true; } checkForCatchAll: { for (CodeException e : exceptionTable) { if (e.getCatchType() == 0) { break checkForCatchAll; } } return true; } LineNumberTable table = method.getLineNumberTable(); if (table == null) { uniqueDereferenceLocations = true; } else { BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); for (Location loc : derefLocationSet) { int lineNumber = table.getSourceLine(loc.getHandle().getPosition()); if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber)) { uniqueDereferenceLocations = true; } } } return uniqueDereferenceLocations; }
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool()); Map<BugAnnotation, String> instanceOfChecks = new HashMap<>();
BitSet linesMentionedMultipleTimes = getClassContext().linesMentionedMultipleTimes(getMethod()); SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(this); boolean possibleClone = source.getStartLine() > 0 && linesMentionedMultipleTimes.get(source.getStartLine());
private void analyzeMethod(ClassContext classContext, Method method) throws CFGBuilderException, DataflowAnalysisException { BitSet lineMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); BitSet linesWithLoadsOfNotDefinitelyNullValues = null;
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); BugAccumulator accumulator = new BugAccumulator(bugReporter); Dataflow<BitSet, LiveLocalStoreAnalysis> llsaDataflow = classContext.getLiveLocalStoreDataflow(method);
location.getHandle()); int line = sourceLine.getStartLine(); BitSet occursMultipleTimes = classContext.linesMentionedMultipleTimes(method); if (line > 0 && occursMultipleTimes.get(line)) { return;
/** * Constructor. * * @param classContext * the ClassContext * @param method * the method to analyze * @param collector * the NullDerefAndRedundantComparisonCollector used to report * null derefs and redundant null comparisons */ public NullDerefAndRedundantComparisonFinder(ClassContext classContext, Method method, NullDerefAndRedundantComparisonCollector collector) { this.classContext = classContext; this.method = method; this.collector = collector; this.findGuaranteedDerefs = classContext.getAnalysisContext().getBoolProperty( AnalysisFeatures.TRACK_GUARANTEED_VALUE_DEREFS_IN_NULL_POINTER_ANALYSIS); this.lineMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); this.redundantBranchList = new LinkedList<RedundantBranch>(); this.definitelySameBranchSet = new BitSet(); this.definitelyDifferentBranchSet = new BitSet(); this.undeterminedBranchSet = new BitSet(); this.assertionMethods = classContext.getAssertionMethods(); }
private boolean uniqueLocations(Collection<Location> derefLocationSet) { boolean uniqueDereferenceLocations = false; LineNumberTable table = method.getLineNumberTable(); if (table == null) { uniqueDereferenceLocations = true; } else { BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); for (Location loc : derefLocationSet) { int lineNumber = table.getSourceLine(loc.getHandle().getPosition()); if (!linesMentionedMultipleTimes.get(lineNumber)) { uniqueDereferenceLocations = true; } } } return uniqueDereferenceLocations; }
private boolean uniqueLocations(Collection<Location> derefLocationSet) { boolean uniqueDereferenceLocations = false; CodeException[] exceptionTable = method.getCode().getExceptionTable(); if (exceptionTable == null) { return true; } checkForCatchAll: { for (CodeException e : exceptionTable) { if (e.getCatchType() == 0) { break checkForCatchAll; } } return true; } LineNumberTable table = method.getLineNumberTable(); if (table == null) { uniqueDereferenceLocations = true; } else { BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); for (Location loc : derefLocationSet) { int lineNumber = table.getSourceLine(loc.getHandle().getPosition()); if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber)) { uniqueDereferenceLocations = true; } } } return uniqueDereferenceLocations; }
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool()); Map<BugAnnotation, String> instanceOfChecks = new HashMap<BugAnnotation, String>();
BitSet linesMentionedMultipleTimes = getClassContext().linesMentionedMultipleTimes(getMethod()); SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(this); boolean possibleClone = source.getStartLine() > 0 && linesMentionedMultipleTimes.get(source.getStartLine());
private void analyzeMethod(ClassContext classContext, Method method) throws CFGBuilderException, DataflowAnalysisException { BitSet lineMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); BitSet linesWithLoadsOfNotDefinitelyNullValues = null;
BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); BugAccumulator accumulator = new BugAccumulator(bugReporter); Dataflow<BitSet, LiveLocalStoreAnalysis> llsaDataflow = classContext.getLiveLocalStoreDataflow(method);
location.getHandle()); int line = sourceLine.getStartLine(); BitSet occursMultipleTimes = classContext.linesMentionedMultipleTimes(method); if (line > 0 && occursMultipleTimes.get(line)) { return;