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

Add support for switch expressions #518

Closed
wants to merge 19 commits into from

Conversation

msridhar
Copy link
Collaborator

Fixes #289

Checker Framework 3.21.0 added support for switch expressions; we build on that to support the expressions in NullAway. We also add a jdk17-unit-tests module to test the support (which requires a JDK 12+ compiler).

}

coverallsJacoco {
reportPath = "jdk17-unit-tests/build/reports/jacoco/test/jacocoTestReport.xml"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an issue of separate coverage files for these tests and the main NullAway tests, so Coveralls may complain. A possible solution is here: https://discuss.gradle.org/t/merge-jacoco-coverage-reports-for-multiproject-setups/12100/6 I propose we go ahead with landing this PR and solve the coverage issue in a follow-up

ExpressionTree switchExpression = tree.getExpression();
if (switchExpression instanceof ParenthesizedTree) {
switchExpression = ((ParenthesizedTree) switchExpression).getExpression();
ExpressionTree switchSelectorExpression = tree.getExpression();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a variable rename (to avoid confusion with switch expressions) and also a comment to explain why parens are being removed

@msridhar msridhar marked this pull request as draft December 18, 2021 17:59
@msridhar
Copy link
Collaborator Author

Working on trying to aggregate coverage, switching to draft for now

@msridhar
Copy link
Collaborator Author

Closing since Coveralls only works when the PR is from a branch on the origin repo

@msridhar msridhar closed this Dec 18, 2021
@msridhar msridhar deleted the handle-switch-expr branch December 18, 2021 18:44
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.

Support switch expressions
1 participant