typetools / typetools/checker-framework

Annotating the receiver

Open
#2,433 0 comments 0 reactions 1 assignee View on GitHub

@smillst is already working on this.

Since Apr 22, 2019.

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

Description

Java does not permit the receiver (the this formal parameter) to be written explicitly on a method in an anonymous class. Therefore, it is not possible to write an annotation on it.

However, it is sometimes necessary to write an annotation on the (inexpressible) receiver.

I propose that the following two syntaxes should have identical effect:

  void myMethod(@Anno MyClass this, int x) { ... }

  @ReceiverQualifier(Anno.class)
  void myMethod(int x) { ... }

Work can occur in the issue2433 branch, which has rudimentary documentation and defines the @ReceiverQualifier annotation (but has no test cases yet).

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.