Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

False Positive: DoNotCallFinalize.ql cannot detect 'finalize()' in the function call chain.

Open
#21,394 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
security

Research direction

Start with java/Violations of Best Practice/Undesirable Calls/DoNotCallFinalize.ql and compare how it handles the direct super.finalize() call with the same call inside callSuperFinalize(). Run the query against both snippets; done means the helper-method version is treated consistently with the direct call and is no longer reported.

Written by the indexing model from the issue text.

Description

false-positive

Version
2.23.9

Description of the false positive

When I use java/Violations of Best Practice/Undesirable Calls/DoNotCallFinalize.ql to detect the code as below, it passes normally.

public class NegCase2 {
    @Override
    protected void finalize() throws Throwable {
        // Override of finalize with super.finalize call is allowed.
        super.finalize();
    }
}

However, when I put "super.finalize();" into another function for calling, DoNotCallFinalize.ql reported a problem.

public class NegCase2_Var3 {
    // Helper method to encapsulate the call
    private void callSuperFinalize() throws Throwable {
        super.finalize(); // [REPORTED LINE]
    }
    @Override
    protected void finalize() throws Throwable {
        // Delegate to helper
        callSuperFinalize();
    }
}

These two code snippets are essentially the same and should both pass the test.

Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 16h
Merged PRs (30d)
143

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql

All issues in github/codeql

Similar issues

More Security issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.