typetools / typetools/checker-framework

Line numbers for delomboked code

Open
#3,387 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Code that Lombok processes is not necessarily legal Java code. (Lombok does various transformations and writes out legal Java bytecodes.) To run the Checker Framework on code that Lombok processes, it is necessary to run the Checker Framework on the output of the delombok tool. Then, the Checker Framework error messages refer not to the user-supplied code, but to temporary directories with modified versions of what the programmer wrote. It is a hassle for programmers to determine where to fix the problems in their code. This hassle is a deal-breaker for some programmers, making them not want to use the Checker Framework.

A solution to this problem would be useful for all static analysis tools, not just the Checker Framework.

A possible solution is:

  • Create a mapping of line numbers from the delomboked code to the developer's source code.
  • Write a tool that post-processes static analysis output: it changes errors/warnings that refer to the delomboked code into errors/warnings that refer to the programmer-written code. Perhaps the postprocessed output would still contain the original warning in the delomboked source code, so the programmer can use it if necessary.

Here are two approaches to create the mapping:

  • Modify the delombok tool. It already has methods endPos() and lineEndPos() that might have some of the needed information. Currently they seem to be used primarily to make sure that comments are copied to the delomboked file.
  • Do textual processing of the original source code and/or the debug information in the .class file (which has correct line numbers), plus of the delomboked source code.

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 by reading the delombok implementation, especially the endPos() and lineEndPos() methods mentioned in the issue, and review the Checker Framework's Lombok documentation. Compare the source, delomboked output, and available class-file debug line information to determine whether a reliable mapping is possible. Done means a defined mapping approach and a tool or integration that rewrites static-analysis locations back to programmer-written source.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, tooling
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.