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

Remove parentheses when after is a unary too #59

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

timtebeek
Copy link
Contributor

@timtebeek timtebeek self-assigned this Jan 2, 2024
@@ -257,7 +257,7 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) {
maybeRemoveImports(staticImports, recipe, entry.getValue(), descriptor.afterTemplate);

List<String> embedOptions = new ArrayList<>();
if (getType(descriptor.afterTemplate) == JCTree.JCParens.class) {
if (getType(descriptor.afterTemplate) == JCTree.JCParens.class || getType(descriptor.afterTemplate) == JCTree.JCUnary.class) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically this matches slightly too wide; in practice I don't expect any of the other unary recipes to be used in after, or running UnnecessaryParenthesesVisitor to cause any issues when they do occur.

@timtebeek timtebeek merged commit 1ca93d9 into main Jan 2, 2024
1 check passed
@timtebeek timtebeek deleted the simplify-ternary branch January 2, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants