typetools / typetools/checker-framework

Support for taking over the ownership of the collection/array/vararg

Open
#6,029 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ResourceLeakChecker
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

A simple example is as follows:

For the resources obtained outside

this works:

class Closeables implements Closeable {
  final @Owning Closeable res1;
  final @Owning Closeable res2;

  Closeables(@Owning r1, @Owning r2) {
    res1 = r1;
    res2 = r2;
  }
...
}

this does not work:

class Closeables implements Closeable {
  final @Owning Closeable[] res;

  Closeables(@Owning Closeable... r) {
    res = r;
  }
...
}

Is there a way to take over the ownership each item of a vararg / array / collection?

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.

Research direction

Start with the Java examples in the issue and investigate how ownership transfer is currently handled for individual parameters versus arrays, varargs, and collections. The issue does not name implementation files or tests; completion would require an agreed behavior and verification for taking ownership of each contained item.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.