NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Mining Fix Patterns for FindBugs Violations

Kui Liu, Dongsun Kim, Tegawendé F. Bissyandé, Shin Yoo, Yves Le Traon

TL;DR

This paper tackles the problem of high false positive rates in static analysis tools like FindBugs, which hinder adoption. They propose a method to mine "fix patterns" from developer-submitted code changes that resolve violations, enabling automated repair and better prioritization of real bugs.

What Problem Does This Paper Address?

Static analysis tools are great for finding potential bugs, but they often flag many issues that aren't real problems (false positives). This leads developers to ignore the tool's warnings, potentially missing actual critical bugs. The authors argue that violations that are consistently fixed by developers are likely true positives. They aim to systematically analyze these fixed violations to understand why they occur and how they are fixed, ultimately creating a way to automatically suggest or apply fixes for similar, unfixed violations.

Methods

The core of their approach involves:

  1. Violation Tracking: They meticulously track FindBugs violations across project revisions to identify which ones are actually fixed by code changes.
  2. Code Pattern Mining: Using Convolutional Neural Networks (CNNs) to learn features from code fragments associated with violations, and then X-means clustering to group similar violations. This helps understand why a violation occurs.
  3. Fix Pattern Mining: Similar to code pattern mining, but applied to the changes made to fix violations. They use CNNs to learn features from these code changes and clustering to group similar fixes. This helps understand how a violation is resolved.
  4. Automated Patch Generation (Implicit): The mined "fix patterns" serve as templates that can be used to generate patches for unfixed violations.

Datasets

  • Custom Dataset: They collected and tracked violations from 730 open-source Java projects, resulting in a dataset of over 16.9 million unique FindBugs violations and nearly 89,000 code changes addressing these violations.
  • Defects4J: Used for evaluating the applicability of their mined fix patterns to real-world bugs.

Key Insights and Ideas

  • Fixed Violations as True Positives: The central idea is that developer-fixed violations are a strong signal of actual bugs, unlike those that are ignored or disappear due to file deletion.
  • Discrepancies in Violation Distribution: The types of violations that are frequently detected are not always the same as those that are frequently fixed, suggesting a need for better prioritization.
  • Fix Patterns as Repair Blueprints: By mining common ways developers fix specific types of violations, they create reusable "blueprints" for automated repair.
  • Developer Acceptance of Automated Fixes: A significant portion of automatically generated fixes based on these patterns are accepted by developers, indicating the practical utility of their approach.

Key Results

  • High Fix Pattern Acceptance: 69 out of 116 (59.5%) of fixes generated from their inferred fix patterns were accepted and merged by developers in live studies.
  • Defects4J Success: Their fix patterns were applicable to 4 real bugs in the Defects4J benchmark.
  • Dataset Contribution: They released a large-scale dataset of tracked violations and fixes, valuable for future research.
  • Prioritization Insights: Their analysis revealed that "Dodgy code," "Performance," and "Bad Practice" are the most addressed violation categories by developers.

Limitations and Future Work

  • Tool Dependency: The study is primarily focused on FindBugs, though the authors suggest their method is generic.
  • Manual Labeling: While the mining process is automated, the final labeling of patterns requires manual assessment.
  • Patch Generation Complexity: Generating patches from fix patterns still requires some manual effort and context.
  • Future Work:
    • Combining fix pattern mining with automated program repair techniques for more automatic fix generation.
  • Investigating the time-varying nature of violation recurrences to improve prioritization.
  • Exploring more advanced static analysis techniques to handle complex code changes and semantic information.

Summary updated

BibTeX
@article{liu2018mining,
  author = {Kui Liu and Dongsun Kim and Tegawendé F. Bissyandé and Shin Yoo and Yves Le Traon},
  title = {{Mining Fix Patterns for FindBugs Violations}},
  journal = {IEEE Transactions on Software Engineering},
  year = {2018},
  doi = {10.1109/tse.2018.2884955},
}
Figure