-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/3156_Lombok_UtilityClass
- Loading branch information
Showing
171 changed files
with
4,668 additions
and
2,337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
rewrite-core/src/main/java/org/openrewrite/ParseErrorPrinter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2023 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; | ||
|
||
import org.openrewrite.marker.Marker; | ||
import org.openrewrite.tree.ParseError; | ||
|
||
public class ParseErrorPrinter<P> extends ParseErrorVisitor<PrintOutputCapture<P>> { | ||
@Override | ||
public ParseError visitParseError(ParseError e, PrintOutputCapture<P> p) { | ||
for (Marker marker : e.getMarkers().getMarkers()) { | ||
p.append(p.getMarkerPrinter().beforePrefix(marker, new Cursor(getCursor(), marker), it -> it)); | ||
} | ||
visitMarkers(e.getMarkers(), p); | ||
for (Marker marker : e.getMarkers().getMarkers()) { | ||
p.append(p.getMarkerPrinter().beforeSyntax(marker, new Cursor(getCursor(), marker), it -> it)); | ||
} | ||
p.append(e.getText()); | ||
for (Marker marker : e.getMarkers().getMarkers()) { | ||
p.append(p.getMarkerPrinter().afterSyntax(marker, new Cursor(getCursor(), marker), it -> it)); | ||
} | ||
return e; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
rewrite-core/src/main/java/org/openrewrite/ParseErrorVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2023 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; | ||
|
||
import org.openrewrite.tree.ParseError; | ||
|
||
public class ParseErrorVisitor <P> extends TreeVisitor<Tree, P> { | ||
|
||
@Override | ||
public boolean isAcceptable(SourceFile sourceFile, P p) { | ||
return sourceFile instanceof ParseError; | ||
} | ||
|
||
@Override | ||
public boolean isAdaptableTo(@SuppressWarnings("rawtypes") Class<? extends TreeVisitor> adaptTo) { | ||
return adaptTo.isAssignableFrom(ParseErrorVisitor.class); | ||
} | ||
|
||
public ParseError visitParseError(ParseError e, P p) { | ||
return e.withMarkers(visitMarkers(e.getMarkers(), p)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.