From 1ae3d07388ec604af46228ebef4a073b84af4b70 Mon Sep 17 00:00:00 2001 From: Andreas Gudian Date: Fri, 16 Oct 2015 22:44:00 +0200 Subject: [PATCH] #701 Update checkstyle version and fix several previously undetected issues in our code (mostly missing whitespaces and redundant modifiers) and in the generated code (superflous whitespaces before commas) Requrires update of guava and cdi-weld do to dependency convergence. --- .../itest/testutil/runner/ProcessorSuite.java | 8 ++++---- integrationtest/src/test/resources/pom.xml | 2 +- parent/pom.xml | 16 +++++++++++----- .../mapstruct/ap/internal/model/Decorator.java | 2 +- .../model/NestedPropertyMappingMethod.java | 2 +- .../ap/internal/model/assignment/Assignment.java | 2 +- .../ap/internal/model/common/Accessibility.java | 2 +- .../ap/internal/model/dependency/Node.java | 2 +- .../ap/internal/option/ReportingPolicy.java | 2 +- .../writer/FreeMarkerModelElementWriter.java | 2 +- .../ap/internal/model/BeanMappingMethod.ftl | 2 +- .../ap/internal/model/DelegatingMethod.ftl | 2 +- .../ap/internal/model/IterableMappingMethod.ftl | 2 +- .../ap/internal/model/MapMappingMethod.ftl | 2 +- .../ap/internal/model/MethodReference.ftl | 6 +++--- .../ap/test/array/ArrayMappingTest.java | 2 +- .../mapstruct/ap/test/builtin/BuiltInTest.java | 8 ++++---- .../MappingResultPostprocessorTest.java | 2 +- .../collection/forged/CollectionMappingTest.java | 2 +- .../NestedMappingMethodInvocationTest.java | 2 +- .../test/selection/qualifier/QualifierTest.java | 4 ++-- .../expressions/java/JavaExpressionTest.java | 2 +- .../ap/test/updatemethods/UpdateMethodsTest.java | 4 ++-- .../selection/ExternalHandWrittenMapper.java | 3 ++- .../runner/ModifiableURLClassLoader.java | 2 +- 25 files changed, 46 insertions(+), 39 deletions(-) diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java index de3b2e7cf..b75bfae66 100644 --- a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java @@ -51,7 +51,7 @@ public @interface ProcessorSuite { * * @author Andreas Gudian */ - public enum ProcessorType { + enum ProcessorType { /** * Use an Oracle JDK 1.6 (or 1.6.x) via toolchain support to perform the processing */ @@ -113,13 +113,13 @@ public @interface ProcessorSuite { private String compilerId; private String sourceTargetVersion; - private ProcessorType(Toolchain toolchain, String compilerId, String sourceTargetVersion) { + ProcessorType(Toolchain toolchain, String compilerId, String sourceTargetVersion) { this.toolchain = toolchain; this.compilerId = compilerId; this.sourceTargetVersion = sourceTargetVersion; } - private ProcessorType(ProcessorType... included) { + ProcessorType(ProcessorType... included) { this.included = included; } @@ -158,7 +158,7 @@ public @interface ProcessorSuite { * * @author Andreas Gudian */ - public interface CommandLineEnhancer { + interface CommandLineEnhancer { /** * @param processorType the processor type for which the test is executed. * @return additional command line arguments to be passed to the Maven {@link Verifier}. diff --git a/integrationtest/src/test/resources/pom.xml b/integrationtest/src/test/resources/pom.xml index 268a9ef4c..bd23b51ce 100644 --- a/integrationtest/src/test/resources/pom.xml +++ b/integrationtest/src/test/resources/pom.xml @@ -37,7 +37,7 @@ ${mapstruct.version} - foobar + mapstruct diff --git a/parent/pom.xml b/parent/pom.xml index d572b412c..e706e3270 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -47,6 +47,7 @@ 2.10.3 4.0.3.RELEASE 0.23.1 + 6.14.1 1 @@ -111,7 +112,7 @@ com.google.guava guava - 14.0.1 + 19.0 com.jolira @@ -126,14 +127,14 @@ com.puppycrawl.tools checkstyle - 5.9 + ${com.puppycrawl.tools.checkstyle.version} javax.enterprise cdi-api - 1.0-SP4 + 1.2 javax.inject @@ -155,7 +156,7 @@ org.jboss.weld weld-core - 1.1.13.Final + 2.3.2.Final org.glassfish @@ -269,7 +270,7 @@ true error true - basedir=${basedir} + basedir=${basedir} - <@includeModel object=ext.targetType raw=true/>.class + <@includeModel object=ext.targetType raw=true/>.class<#t> <#elseif param.mappingTarget> ${ext.targetBeanName}.${ext.targetReadAccessorName}() <#else> <@_assignment/> - <#if param_has_next>, + <#if param_has_next>, <#t> <#-- context parameter, e.g. for builtin methods concerning date conversion --> - <#if contextParam??>, ${contextParam} + <#if contextParam??>, ${contextParam}<#t> <#macro _assignment> <@includeModel object=assignment diff --git a/processor/src/test/java/org/mapstruct/ap/test/array/ArrayMappingTest.java b/processor/src/test/java/org/mapstruct/ap/test/array/ArrayMappingTest.java index 41857ca08..ac490fb4a 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/array/ArrayMappingTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/array/ArrayMappingTest.java @@ -46,7 +46,7 @@ public class ArrayMappingTest { assertThat( dto ).isNotNull(); assertThat( dto ).isNotEqualTo( source ); - assertThat( dto.getPublications() ).containsOnly( "the Lancet", "Nature"); + assertThat( dto.getPublications() ).containsOnly( "the Lancet", "Nature" ); } @Test diff --git a/processor/src/test/java/org/mapstruct/ap/test/builtin/BuiltInTest.java b/processor/src/test/java/org/mapstruct/ap/test/builtin/BuiltInTest.java index 8ddacc385..e032cdf06 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/builtin/BuiltInTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/builtin/BuiltInTest.java @@ -237,7 +237,7 @@ public class BuiltInTest { DateProperty target = CalendarToDateMapper.INSTANCE.map( source ); assertThat( target ).isNotNull(); assertThat( target.getProp() ).isNotNull(); - assertThat( target.getProp()).isEqualTo( createCalendar( "02.03.1999" ).getTime()); + assertThat( target.getProp() ).isEqualTo( createCalendar( "02.03.1999" ).getTime() ); } @Test @@ -250,7 +250,7 @@ public class BuiltInTest { CalendarProperty target = DateToCalendarMapper.INSTANCE.map( source ); assertThat( target ).isNotNull(); assertThat( target.getProp() ).isNotNull(); - assertThat( target.getProp()).isEqualTo( createCalendar( "02.03.1999" )); + assertThat( target.getProp() ).isEqualTo( createCalendar( "02.03.1999" ) ); } @@ -264,7 +264,7 @@ public class BuiltInTest { StringProperty target = CalendarToStringMapper.INSTANCE.map( source ); assertThat( target ).isNotNull(); assertThat( target.getProp() ).isNotNull(); - assertThat( target.getProp()).isEqualTo( "02.03.1999" ); + assertThat( target.getProp() ).isEqualTo( "02.03.1999" ); } @Test @@ -277,7 +277,7 @@ public class BuiltInTest { CalendarProperty target = StringToCalendarMapper.INSTANCE.map( source ); assertThat( target ).isNotNull(); assertThat( target.getProp() ).isNotNull(); - assertThat( target.getProp()).isEqualTo( createCalendar( "02.03.1999" ) ); + assertThat( target.getProp() ).isEqualTo( createCalendar( "02.03.1999" ) ); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/callbacks/ongeneratedmethods/MappingResultPostprocessorTest.java b/processor/src/test/java/org/mapstruct/ap/test/callbacks/ongeneratedmethods/MappingResultPostprocessorTest.java index ee544976f..01a6522fc 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/callbacks/ongeneratedmethods/MappingResultPostprocessorTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/callbacks/ongeneratedmethods/MappingResultPostprocessorTest.java @@ -52,7 +52,7 @@ public class MappingResultPostprocessorTest { // setup Address address = new Address(); - address.setAddressLine( "RoadToNowhere;5"); + address.setAddressLine( "RoadToNowhere;5" ); address.setTown( "SmallTown" ); Employee employee = new Employee(); employee.setAddress( address ); diff --git a/processor/src/test/java/org/mapstruct/ap/test/collection/forged/CollectionMappingTest.java b/processor/src/test/java/org/mapstruct/ap/test/collection/forged/CollectionMappingTest.java index c2a9413e8..3a2eb2c5e 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/collection/forged/CollectionMappingTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/collection/forged/CollectionMappingTest.java @@ -51,7 +51,7 @@ public class CollectionMappingTest { public void shouldForgeNewIterableMappingMethod() { Source source = new Source(); - source.setFooSet( Collections.asSet( "1", "2") ); + source.setFooSet( Collections.asSet( "1", "2" ) ); Target target = CollectionMapper.INSTANCE.sourceToTarget( source ); assertThat( target ).isNotNull(); diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedmethodcall/NestedMappingMethodInvocationTest.java b/processor/src/test/java/org/mapstruct/ap/test/nestedmethodcall/NestedMappingMethodInvocationTest.java index ddfb85bb6..9b95cd65c 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedmethodcall/NestedMappingMethodInvocationTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedmethodcall/NestedMappingMethodInvocationTest.java @@ -106,7 +106,7 @@ public class NestedMappingMethodInvocationTest { assertThat( source ).isNotNull(); assertThat( source.getDate().getValue() ).isEqualTo( "06.07.2013" ); - assertThat( source.getDate().getName()).isEqualTo( QNAME ); + assertThat( source.getDate().getName() ).isEqualTo( QNAME ); } private OrderType createOrderType() throws DatatypeConfigurationException { diff --git a/processor/src/test/java/org/mapstruct/ap/test/selection/qualifier/QualifierTest.java b/processor/src/test/java/org/mapstruct/ap/test/selection/qualifier/QualifierTest.java index 1912338b4..477def7e2 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/selection/qualifier/QualifierTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/selection/qualifier/QualifierTest.java @@ -100,7 +100,7 @@ public class QualifierTest { assertThat( germanMovies.getFacts() ).includes( entry( "Regisseur", Arrays.asList( "M. Night Shyamalan" ) ), entry( "Besetzung", Arrays.asList( "Bruce Willis", "Haley Joel Osment", "Toni Collette" ) ), - entry( "Handlungstichwörter", Arrays.asList( "Jungen", "Kinderpsychologe", "Ich sehe tote Menschen" ) ) + entry( "Handlungstichwörter", Arrays.asList( "Jungen", "Kinderpsychologe", "Ich sehe tote Menschen" ) ) ); } @@ -139,7 +139,7 @@ public class QualifierTest { GermanRelease result = MapperWithoutQualifiedBy.INSTANCE.map( foreignMovies ); assertThat( result ).isNotNull(); - assertThat( result.getTitle() ).isEqualTo( "ehT ,esneS htxiS"); + assertThat( result.getTitle() ).isEqualTo( "ehT ,esneS htxiS" ); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/source/expressions/java/JavaExpressionTest.java b/processor/src/test/java/org/mapstruct/ap/test/source/expressions/java/JavaExpressionTest.java index bc44930d9..b8ba11353 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/source/expressions/java/JavaExpressionTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/source/expressions/java/JavaExpressionTest.java @@ -60,7 +60,7 @@ public class JavaExpressionTest { @Test @WithClasses({ Source.class, - Source2.class , + Source2.class, Target.class, TimeAndFormat.class, SourceTargetMapperSeveralSources.class diff --git a/processor/src/test/java/org/mapstruct/ap/test/updatemethods/UpdateMethodsTest.java b/processor/src/test/java/org/mapstruct/ap/test/updatemethods/UpdateMethodsTest.java index 33332407a..08a1855d4 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/updatemethods/UpdateMethodsTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/updatemethods/UpdateMethodsTest.java @@ -76,7 +76,7 @@ public class UpdateMethodsTest { assertThat( organizationEntity.getCompany() ).isEqualTo( companyEntity ); assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" ); assertThat( organizationEntity.getType().getType() ).isEqualTo( "commercial" ); - assertThat( organizationEntity.getTypeNr().getNumber()).isEqualTo( 5 ); + assertThat( organizationEntity.getTypeNr().getNumber() ).isEqualTo( 5 ); assertThat( organizationEntity.getCompany().getDepartment().getName() ).isEqualTo( "finance" ); } @@ -124,7 +124,7 @@ public class UpdateMethodsTest { assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" ); assertThat( organizationEntity.getType().getType() ).isEqualTo( "commercial" ); - assertThat( organizationEntity.getTypeNr().getNumber()).isEqualTo( 5 ); + assertThat( organizationEntity.getTypeNr().getNumber() ).isEqualTo( 5 ); assertThat( organizationEntity.getCompany().getDepartment().getName() ).isEqualTo( "finance" ); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/updatemethods/selection/ExternalHandWrittenMapper.java b/processor/src/test/java/org/mapstruct/ap/test/updatemethods/selection/ExternalHandWrittenMapper.java index 572272dce..d0e6a8600 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/updatemethods/selection/ExternalHandWrittenMapper.java +++ b/processor/src/test/java/org/mapstruct/ap/test/updatemethods/selection/ExternalHandWrittenMapper.java @@ -57,7 +57,8 @@ public class ExternalHandWrittenMapper { if ( entityMap != null && dtoMap != null ) { for ( Map.Entry dtoEntry : dtoMap.entrySet() ) { - entityMap.put( DepartmentMapper.INSTANCE.toSecretaryEntity( dtoEntry.getKey() ) , + entityMap.put( + DepartmentMapper.INSTANCE.toSecretaryEntity( dtoEntry.getKey() ), DepartmentMapper.INSTANCE.toEmployeeEntity( dtoEntry.getValue() ) ); } } diff --git a/processor/src/test/java/org/mapstruct/ap/testutil/runner/ModifiableURLClassLoader.java b/processor/src/test/java/org/mapstruct/ap/testutil/runner/ModifiableURLClassLoader.java index 7e19f6aca..599dee78b 100644 --- a/processor/src/test/java/org/mapstruct/ap/testutil/runner/ModifiableURLClassLoader.java +++ b/processor/src/test/java/org/mapstruct/ap/testutil/runner/ModifiableURLClassLoader.java @@ -98,7 +98,7 @@ public class ModifiableURLClassLoader extends URLClassLoader { private static final class FilteringParentClassLoader extends ClassLoader { private String excludedPackage; - public FilteringParentClassLoader(String excludedPackage) { + FilteringParentClassLoader(String excludedPackage) { this.excludedPackage = excludedPackage; }