Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't mangle non-javadoc block comments
Previously leading whitespace was being removed from non-javadoc block comments, which destroyed existing formatting. This change preserves the relative indentation of those block comments. Also: for javadoc and block comments with leading '*'s, add missing '*'s while re-indenting. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=105236622
- Loading branch information
Showing
4 changed files
with
262 additions
and
12 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
76 changes: 76 additions & 0 deletions
76
core/src/test/resources/com/google/googlejavaformat/java/testdata/B24543625.input
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,76 @@ | |||
/** | |||
* This<br> | |||
* is<br> | |||
* a<br> | |||
* train. | |||
*/ | |||
class TheTrain { | |||
/* | |||
______ | |||
.-"""".._'. _,## | |||
_..__ |.-"""-.| | _,##'`-._ | |||
(_____)||_____|| |_,##'`-._,##'` | |||
_| |.;-""-. | |#'`-._,##'` | |||
_.;_ `--' `\ \ |.'`\._,##'` | |||
/.-.\ `\ |.-";.`_, |##'` | |||
|\__/ | _..;__ |'-' / | |||
'.____.'_.-`)\--' /'-'` | |||
//||\\(_.-'_,'-'` | |||
(`-...-')_,##'` | |||
jgs _,##`-..,-;##` | |||
_,##'`-._,##'` | |||
_,##'`-._,##'` | |||
`-._,##'` | |||
*/ | |||
public static final Object THE_TRAIN = null; | |||
|
|||
/* | |||
BLOCK COMMENT | |||
|
|||
*/ | |||
int x; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int y; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int z; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int z; | |||
|
|||
/* | |||
* This is almost javadoc. | |||
* | |||
*/ | |||
int z; | |||
|
|||
/** | |||
* This is (was) malformed javadoc. | |||
* <pre> | |||
System.err.println | |||
* </pre> | |||
*/ | |||
int z; | |||
|
|||
private Object f; /*-{ | |||
System.err.println("asd"); | |||
}-*/ | |||
|
|||
private native Object f() /*-{ | |||
System.err.println("asd"); | |||
}-*/; | |||
|
|||
private native Object f() /*-{ | |||
System.err.println("asd"); | |||
}-*/; | |||
} |
76 changes: 76 additions & 0 deletions
76
core/src/test/resources/com/google/googlejavaformat/java/testdata/B24543625.output
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,76 @@ | |||
/** | |||
* This<br> | |||
* is<br> | |||
* a<br> | |||
* train. | |||
*/ | |||
class TheTrain { | |||
/* | |||
______ | |||
.-"""".._'. _,## | |||
_..__ |.-"""-.| | _,##'`-._ | |||
(_____)||_____|| |_,##'`-._,##'` | |||
_| |.;-""-. | |#'`-._,##'` | |||
_.;_ `--' `\ \ |.'`\._,##'` | |||
/.-.\ `\ |.-";.`_, |##'` | |||
|\__/ | _..;__ |'-' / | |||
'.____.'_.-`)\--' /'-'` | |||
//||\\(_.-'_,'-'` | |||
(`-...-')_,##'` | |||
jgs _,##`-..,-;##` | |||
_,##'`-._,##'` | |||
_,##'`-._,##'` | |||
`-._,##'` | |||
*/ | |||
public static final Object THE_TRAIN = null; | |||
|
|||
/* | |||
BLOCK COMMENT | |||
|
|||
*/ | |||
int x; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int y; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int z; | |||
|
|||
/* . | |||
BLOCK COMMENT . | |||
|
|||
*/ | |||
int z; | |||
|
|||
/* | |||
* This is almost javadoc. | |||
* | |||
*/ | |||
int z; | |||
|
|||
/** | |||
* This is (was) malformed javadoc. | |||
* <pre> | |||
* System.err.println | |||
* </pre> | |||
*/ | |||
int z; | |||
|
|||
private Object f; /*-{ | |||
System.err.println("asd"); | |||
}-*/ | |||
|
|||
private native Object f() /*-{ | |||
System.err.println("asd"); | |||
}-*/; | |||
|
|||
private native Object f() /*-{ | |||
System.err.println("asd"); | |||
}-*/; | |||
} |