typetools / typetools/checker-framework
@GuardSatisfied on array elements
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
The Lock Checker forbids using @GuardSatisfied on an array element type; you get a warning message such as:
GuardSatisfiedArray.java:7: error: [guardsatisfied.location.disallowed] @GuardSatisfied annotations are only allowed on method return types, receivers and parameters.
void bar(@GuardSatisfied Object[] args) {
^
1 error
I believe that @GuardSatisfied should be permitted on all components of a return or formal parameter type. This includes array element types.
I don't remember a theoretical reason why @GuardSatisfied is not permitted on non-top-level components -- that is, I don't see a type loophole.
There is a test case in file checker/tests/lock/GuardSatisfiedArray.java .
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with checker/tests/lock/GuardSatisfiedArray.java and run the Lock Checker test that demonstrates the current diagnostic. Trace the Lock Checker handling of @GuardSatisfied locations and determine how array element types are rejected. Done means the test permits @GuardSatisfied on array elements of return or formal parameter types without emitting the disallowed-location error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100