mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#626 Remove doubled blank lines on Windows
This commit is contained in:
parent
9ccc9726ff
commit
2c2f69b0d3
@ -71,7 +71,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
State newState = currentState.handleCharacter( c, context );
|
State newState = currentState.handleCharacter( c, context );
|
||||||
|
|
||||||
if ( newState != currentState ) {
|
if ( newState != currentState ) {
|
||||||
currentState.onExit( context );
|
currentState.onExit( context, newState );
|
||||||
newState.onEntry( context );
|
newState.onEntry( context );
|
||||||
currentState = newState;
|
currentState = newState;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
currentState.onExit( context );
|
currentState.onExit( context, null );
|
||||||
context.writer.close();
|
context.writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
* Writes out the current text.
|
* Writes out the current text.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
flush( context );
|
flush( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
* Writes out the current text.
|
* Writes out the current text.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
flush( context );
|
flush( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
* Writes out the current text.
|
* Writes out the current text.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
flush( context );
|
flush( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
* Writes out the current text.
|
* Writes out the current text.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
flush( context );
|
flush( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,19 +320,21 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
* Writes out the current line-breaks, avoiding more than one consecutive empty line
|
* Writes out the current line-breaks, avoiding more than one consecutive empty line
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
context.consecutiveLineBreaks++;
|
context.consecutiveLineBreaks++;
|
||||||
int lineBreaks = Math.min( context.consecutiveLineBreaks, 2 );
|
if ( nextState != IN_LINE_BREAK ) {
|
||||||
|
int lineBreaks = Math.min( context.consecutiveLineBreaks, 2 );
|
||||||
|
|
||||||
for ( int i = 0; i < lineBreaks; i++ ) {
|
for ( int i = 0; i < lineBreaks; i++ ) {
|
||||||
context.writer.append( LINE_SEPARATOR );
|
context.writer.append( LINE_SEPARATOR );
|
||||||
|
|
||||||
if ( DEBUG ) {
|
if ( DEBUG ) {
|
||||||
System.out.print( "\\n" + LINE_SEPARATOR );
|
System.out.print( "\\n" + LINE_SEPARATOR );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
context.consecutiveLineBreaks = 0;
|
context.consecutiveLineBreaks = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -352,7 +354,7 @@ class IndentationCorrectingWriter extends Writer {
|
|||||||
void doOnEntry(StateContext context) throws IOException {
|
void doOnEntry(StateContext context) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onExit(StateContext context) throws IOException {
|
void onExit(StateContext context, State nextState) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onBufferFinished(StateContext context) throws IOException {
|
void onBufferFinished(StateContext context) throws IOException {
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
<property name="format" value="\S\z" />
|
<property name="format" value="\S\z" />
|
||||||
<property name="message" value="There is no new line at the end of file" />
|
<property name="message" value="There is no new line at the end of file" />
|
||||||
</module>
|
</module>
|
||||||
|
<module name="RegexpMultiline">
|
||||||
|
<property name="format" value="(\r\n\r\n\r\n|\r\r\r|\n\n\n)" />
|
||||||
|
<property name="message" value="There are multiple blank lines" />
|
||||||
|
</module>
|
||||||
|
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<!-- \s matches whitespace character, $ matches end of line. -->
|
<!-- \s matches whitespace character, $ matches end of line. -->
|
||||||
@ -91,7 +95,6 @@
|
|||||||
<module name="WhitespaceAfter"/>
|
<module name="WhitespaceAfter"/>
|
||||||
<module name="WhitespaceAround"/>
|
<module name="WhitespaceAround"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- Modifier Checks -->
|
<!-- Modifier Checks -->
|
||||||
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
|
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
|
||||||
<module name="ModifierOrder"/>
|
<module name="ModifierOrder"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user