You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: checker to prevent other checkers from calling javac methods that changed across JDKs #4026
It might be nice to have a checker that flags when other checkers are calling the methods whose signatures have changed. Maybe just like the DoNotCallChecker but a separate implementation? This way checkers could share knowledge on what calls to avoid moving forward. (This kind of issue will get caught if tests are configured to run on older JDKs, which NullAway does now, but we still missed apache/nullaway#794 due to a lack of unit test coverage.)
I created ASTHelpersSuggestions as a partial solution to this, e.g. for the com.sun.tools.javac.util.Filter issue there's a wrapper API in ASTHelpers, and that check suggests using the wrapper API.
I'd be happy to review PRs to improve coverage in this area. It might make sense to add additional APIs to ASTHelpersSuggestions, and maybe rename the check.
This could also potentially be a separate check if not all of the issues have ASTHelpers workarounds, or if that would be more useful. I saw in apache/nullaway#779 that you used your own wrapper API because you weren't on Error Prone 2.20.0 yet. Would it be good enough to have a check that caught these issues and suggested ASTHelpers, since even if you could apply the fix as-is the finding would still be useful?
(Edited: previously this comment referred to a bad call that looked like it was getting missed but it was due to a @SuppressWarnings 🤦♂️ removed that part)
The ASTHelpersSuggestions check looks like exactly what I was looking for! Thanks for the pointer! In fact we were already running the check :-) Looks like we had some suppressions of that check; we'll be more careful in the future.
Would it be good enough to have a check that caught these issues and suggested ASTHelpers, since even if you could apply the fix as-is the finding would still be useful?
Yes, as long as it flags issues this is still very useful to us, even if we can't apply the auto-fix.
I opened #4027 to improve coverage of ASTHelpersSuggestions a bit. Beyond that, I think the check / error messages could be renamed to better convey the potential consequences of calling the javac APIs directly. I can put up a PR for that too, but didn't have a good idea on what to rename the check to exactly.
Activity
cushon commentedon Jul 29, 2023
This SGTM.
I created
ASTHelpersSuggestionsas a partial solution to this, e.g. for thecom.sun.tools.javac.util.Filterissue there's a wrapper API inASTHelpers, and that check suggests using the wrapper API.I'd be happy to review PRs to improve coverage in this area. It might make sense to add additional APIs to
ASTHelpersSuggestions, and maybe rename the check.This could also potentially be a separate check if not all of the issues have
ASTHelpersworkarounds, or if that would be more useful. I saw in apache/nullaway#779 that you used your own wrapper API because you weren't on Error Prone 2.20.0 yet. Would it be good enough to have a check that caught these issues and suggestedASTHelpers, since even if you could apply the fix as-is the finding would still be useful?msridhar commentedon Jul 29, 2023
(Edited: previously this comment referred to a bad call that looked like it was getting missed but it was due to a
@SuppressWarnings🤦♂️ removed that part)The
ASTHelpersSuggestionscheck looks like exactly what I was looking for! Thanks for the pointer! In fact we were already running the check :-) Looks like we had some suppressions of that check; we'll be more careful in the future.Yes, as long as it flags issues this is still very useful to us, even if we can't apply the auto-fix.
msridhar commentedon Jul 31, 2023
I opened #4027 to improve coverage of
ASTHelpersSuggestionsa bit. Beyond that, I think the check / error messages could be renamed to better convey the potential consequences of calling the javac APIs directly. I can put up a PR for that too, but didn't have a good idea on what to rename the check to exactly.Add support in ASTHelpersSuggestions for getEnclosedElements
Add support in ASTHelpersSuggestions for getEnclosedElements
cushon commentedon Sep 7, 2023
I'm going to close this out now that #4029 has landed, thanks!
I don't have any brilliant ideas for this either, but proposals are welcome if you think of a name that would be clearer.