Update checkstyle to latest version and replace deprecated methods (#1764)

This commit is contained in:
Filip Hrisafov 2019-03-23 21:25:08 +01:00 committed by GitHub
parent 63c5fc8eff
commit 39481f98c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -28,7 +28,7 @@
<org.apache.maven.plugins.javadoc.version>3.1.0</org.apache.maven.plugins.javadoc.version> <org.apache.maven.plugins.javadoc.version>3.1.0</org.apache.maven.plugins.javadoc.version>
<org.springframework.version>4.0.3.RELEASE</org.springframework.version> <org.springframework.version>4.0.3.RELEASE</org.springframework.version>
<org.eclipse.tycho.compiler-jdt.version>0.26.0</org.eclipse.tycho.compiler-jdt.version> <org.eclipse.tycho.compiler-jdt.version>0.26.0</org.eclipse.tycho.compiler-jdt.version>
<com.puppycrawl.tools.checkstyle.version>8.14</com.puppycrawl.tools.checkstyle.version> <com.puppycrawl.tools.checkstyle.version>8.18</com.puppycrawl.tools.checkstyle.version>
<add.release.arguments /> <add.release.arguments />
<forkCount>1</forkCount> <forkCount>1</forkCount>
<assertj.version>3.11.1</assertj.version> <assertj.version>3.11.1</assertj.version>

View File

@ -25,6 +25,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
@ -214,10 +215,18 @@ abstract class CompilingStatement extends Statement {
new InputSource( getClass().getClassLoader().getResourceAsStream( new InputSource( getClass().getClassLoader().getResourceAsStream(
"checkstyle-for-generated-sources.xml" ) ), "checkstyle-for-generated-sources.xml" ) ),
new PropertiesExpander( properties ), new PropertiesExpander( properties ),
true ) ); ConfigurationLoader.IgnoredModulesOptions.OMIT
) );
ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
checker.addListener( new DefaultLogger( ByteStreams.nullOutputStream(), true, errorStream, true ) ); checker.addListener(
new DefaultLogger(
ByteStreams.nullOutputStream(),
AutomaticBean.OutputStreamOptions.CLOSE,
errorStream,
AutomaticBean.OutputStreamOptions.CLOSE
)
);
int errors = checker.process( findGeneratedFiles( new File( sourceOutputDir ) ) ); int errors = checker.process( findGeneratedFiles( new File( sourceOutputDir ) ) );
if ( errors > 0 ) { if ( errors > 0 ) {