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: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes #3676

Merged

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Nov 3, 2020

Fix #3675

This PR fixes the problem explained in #3675 by overriding printTypes in SniperJavaPrettyPrinter, and trying to resolve a compilation unit from the types passed in. If no compilation unit can be found, or the types have mismatching compilation units, it raises an exception. Two new tests verify the behavior within a reasonable amount of certainty.

@slarse slarse changed the title wip: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes review: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes Nov 3, 2020
@slarse
Copy link
Collaborator Author

slarse commented Nov 3, 2020

This is ready for review.

@slarse slarse changed the title review: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes review: fix: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes Nov 3, 2020
@monperrus
Copy link
Collaborator

Thanks! LGTM, will merge after the typical one-day latency for everybody to see it.

@monperrus monperrus changed the title review: fix: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes fix: Fix NullPointerException in SniperJavaPrettyPrinter.printTypes Nov 5, 2020
@monperrus monperrus merged commit ad8be93 into INRIA:master Nov 5, 2020
@monperrus
Copy link
Collaborator

Thanks a lot @slarse

@slarse slarse deleted the issue/3675-fix-sniper-printer-printTypes-method branch May 28, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Calling printTypes on SniperJavaPrettyPrinter always causes a NullPointerException
2 participants