Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf32717

Browse filesBrowse files
committed
Make some helper methods protected in DefaultPrettyPrinterVisitor
This makes it much easier to override visitor methods
1 parent 885a524 commit cf32717
Copy full SHA for cf32717

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎javaparser-core/src/main/java/com/github/javaparser/printer/DefaultPrettyPrinterVisitor.java

Copy file name to clipboardExpand all lines: javaparser-core/src/main/java/com/github/javaparser/printer/DefaultPrettyPrinterVisitor.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ public void visit(UnparsableStmt n, Void arg) {
18461846
printer.print("???;");
18471847
}
18481848

1849-
private void printImports(NodeList<ImportDeclaration> imports, Void arg) {
1849+
protected void printImports(NodeList<ImportDeclaration> imports, Void arg) {
18501850
ImportOrderingStrategy strategy = new DefaultImportOrderingStrategy();
18511851
// Get Import strategy from configuration
18521852
Optional<ConfigurationOption> optionalStrategy = getOption(ConfigOption.SORT_IMPORTS_STRATEGY);
@@ -1871,7 +1871,7 @@ private void printImports(NodeList<ImportDeclaration> imports, Void arg) {
18711871
}
18721872
}
18731873

1874-
private void printOrphanCommentsBeforeThisChildNode(final Node node) {
1874+
protected void printOrphanCommentsBeforeThisChildNode(final Node node) {
18751875
if (!getOption(ConfigOption.PRINT_COMMENTS).isPresent()) return;
18761876
if (node instanceof Comment) return;
18771877
Node parent = node.getParentNode().orElse(null);
@@ -1903,7 +1903,7 @@ private void printOrphanCommentsBeforeThisChildNode(final Node node) {
19031903
}
19041904
}
19051905

1906-
private void printOrphanCommentsEnding(final Node node) {
1906+
protected void printOrphanCommentsEnding(final Node node) {
19071907
if (!getOption(ConfigOption.PRINT_COMMENTS).isPresent()) return;
19081908
List<Node> everything = new ArrayList<>(node.getChildNodes());
19091909
sortByBeginPosition(everything);
@@ -1932,7 +1932,7 @@ private void unindentIf(boolean expr) {
19321932
if (expr) printer.unindent();
19331933
}
19341934

1935-
private Optional<ConfigurationOption> getOption(ConfigOption cOption) {
1935+
protected Optional<ConfigurationOption> getOption(ConfigOption cOption) {
19361936
return configuration.get(new DefaultConfigurationOption(cOption));
19371937
}
19381938
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.