Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors when suggesting replacements to Lombok generated code #1195

Conversation

RichardBradley
Copy link
Contributor

I am trying to introduce error-prone to a large codebase which uses Lombok (see also #1185).

I have found that a few rules attempt to suggest fixes to code that Lombok has auto-generated, particularly "setters" and "withers" which use reference equality in a way that upsets some rules.

This auto-generated bytecode does not have valid positions in the sourcecode files, so fix suggestion throws an exception.

This change ignores that exception and skips the fixes in question.

@RichardBradley
Copy link
Contributor Author

Are you waiting for anything from me on this?
Is there anything I can do to get this merged in?

Thanks,

Rich

yasserg pushed a commit to yasserg/error-prone that referenced this pull request Jun 28, 2019
yasserg pushed a commit to yasserg/error-prone that referenced this pull request Mar 2, 2020
yasserg pushed a commit to yasserg/error-prone that referenced this pull request May 30, 2020
yasserg pushed a commit to yasserg/error-prone that referenced this pull request Jan 12, 2021
@cushon
Copy link
Collaborator

cushon commented Jan 19, 2021

Hi, sorry for not responding to this earlier.

I would prefer to avoid handling these errors at this level and discarding the invalid fixes. While this does work around some of the issues with lombok creating AST nodes with invalid source positions, it would also cause Error Prone to silently skip fixes that were incorrect for other reasons, e.g. if there was a bug in a check.

There's some related discussion about the underlying problem lombok creates for Error Prone in #1250 (comment), and a link to an upstream lombok bug with they're considering fixing up the source position information for the AST nodes lombok edits, which would help prevent this kind of crash. I'm hopeful that approach will result in a solution that allows lombok and Error Prone to run in the same compilation without crashing Error Prone.

@cushon cushon closed this Jan 19, 2021
yasserg pushed a commit to yasserg/error-prone that referenced this pull request Sep 21, 2021
yasserg pushed a commit to yasserg/error-prone that referenced this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants