Skip to content

Commit

Permalink
Revert "Remove deprecated groovy OmitParentheses"
Browse files Browse the repository at this point in the history
This reverts commit 4c21910.
  • Loading branch information
jevanlingen committed Dec 11, 2024
1 parent 4c21910 commit fb1d276
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.openrewrite.groovy.tree.GSpace;
import org.openrewrite.java.JavaPrinter;
import org.openrewrite.java.marker.CompactConstructor;
import org.openrewrite.java.marker.OmitParentheses;
import org.openrewrite.java.tree.*;
import org.openrewrite.marker.Marker;
import org.openrewrite.marker.Markers;
Expand Down Expand Up @@ -424,7 +423,8 @@ public J visitMethodInvocation(J.MethodInvocation method, PrintOutputCapture<P>
boolean applyTrailingLambdaParenthese = true;
for (int i = 0; i < args.size(); i++) {
JRightPadded<Expression> arg = args.get(i);
boolean omitParensCurrElem = arg.getElement().getMarkers().findFirst(OmitParentheses.class).isPresent();
boolean omitParensCurrElem = arg.getElement().getMarkers().findFirst(OmitParentheses.class).isPresent() ||
arg.getElement().getMarkers().findFirst(org.openrewrite.java.marker.OmitParentheses.class).isPresent();

if (i == 0) {
if (omitParensCurrElem) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2021 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openrewrite.groovy.marker;

import lombok.Value;
import lombok.With;
import org.openrewrite.marker.Marker;

import java.util.UUID;

/**
* See the Groovy style guide on <a href="http://www.groovy-lang.org/style-guide.html#_omitting_parentheses">Omitting parentheses</a>.
*
* @deprecated Use {@link org.openrewrite.java.marker.OmitParentheses} instead.
*/
@Value
@With
@Deprecated
public class OmitParentheses implements Marker {
UUID id;
}

0 comments on commit fb1d276

Please sign in to comment.