Resource leaks, where resources like files, database connections, or streams aren’t properly released after use, are a persistent issue in Java applications. These leaks can lead to performance degradation, and system failures. While tools like SonarSource SonarQube™ effectively identify such leaks, the fixing process remains manual, time-consuming, and prone to errors. To address this, we developed FixrLeak, a generative AI-based framework that automates the detection and repair of resource leaks. FixrLeak combines Abstract Syntax Tree (AST) analysis with generative AI (GenAI) to produce accurate, idiomatic fixes while following Java best practices like try-with-resources. Deployed within Uber’s extensive Java codebase, FixrLeak significantly reduces manual effort, improves developer productivity, and improves code quality, showcasing the transformative potential of AI-driven solutions in large-scale software engineering.

  • Lysergid@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    2 days ago

    If one needs AI to add try-with-resources then one shouldn’t code professionally

  • TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 days ago

    This seems like the same problem that lifetimes solve in Rust - tracking when values are no longer used and thus fall “out of scope”. Automated tooling should really be doing lifetime analysis of these values, and that seems to me like it would fall well out of scope of what GenAI can be trusted to do.

    If this is such a huge problem, are you able to create finalizers that close the resources instead, or better abstractions for managing the LTs of these resources? I don’t write Java anymore, but this seems like a problem better solved by other tools.