#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.
This commit is contained in:
Andreas Gudian 2015-10-16 22:44:00 +02:00
parent 5831e824e1
commit 1ae3d07388
25 changed files with 46 additions and 39 deletions

View File

@ -51,7 +51,7 @@ public @interface ProcessorSuite {
* *
* @author Andreas Gudian * @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 * 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 compilerId;
private String sourceTargetVersion; private String sourceTargetVersion;
private ProcessorType(Toolchain toolchain, String compilerId, String sourceTargetVersion) { ProcessorType(Toolchain toolchain, String compilerId, String sourceTargetVersion) {
this.toolchain = toolchain; this.toolchain = toolchain;
this.compilerId = compilerId; this.compilerId = compilerId;
this.sourceTargetVersion = sourceTargetVersion; this.sourceTargetVersion = sourceTargetVersion;
} }
private ProcessorType(ProcessorType... included) { ProcessorType(ProcessorType... included) {
this.included = included; this.included = included;
} }
@ -158,7 +158,7 @@ public @interface ProcessorSuite {
* *
* @author Andreas Gudian * @author Andreas Gudian
*/ */
public interface CommandLineEnhancer { interface CommandLineEnhancer {
/** /**
* @param processorType the processor type for which the test is executed. * @param processorType the processor type for which the test is executed.
* @return additional command line arguments to be passed to the Maven {@link Verifier}. * @return additional command line arguments to be passed to the Maven {@link Verifier}.

View File

@ -37,7 +37,7 @@
<properties> <properties>
<mapstruct.version>${mapstruct.version}</mapstruct.version> <mapstruct.version>${mapstruct.version}</mapstruct.version>
<mapstruct-artifact-id>foobar</mapstruct-artifact-id> <mapstruct-artifact-id>mapstruct</mapstruct-artifact-id>
<toolchain-jdk-version></toolchain-jdk-version> <toolchain-jdk-version></toolchain-jdk-version>
<toolchain-jdk-vendor></toolchain-jdk-vendor> <toolchain-jdk-vendor></toolchain-jdk-vendor>
<compiler-id></compiler-id> <compiler-id></compiler-id>

View File

@ -47,6 +47,7 @@
<org.apache.maven.plugins.javadoc.version>2.10.3</org.apache.maven.plugins.javadoc.version> <org.apache.maven.plugins.javadoc.version>2.10.3</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.23.1</org.eclipse.tycho.compiler-jdt.version> <org.eclipse.tycho.compiler-jdt.version>0.23.1</org.eclipse.tycho.compiler-jdt.version>
<com.puppycrawl.tools.checkstyle.version>6.14.1</com.puppycrawl.tools.checkstyle.version>
<add.release.arguments /> <add.release.arguments />
<forkCount>1</forkCount> <forkCount>1</forkCount>
</properties> </properties>
@ -111,7 +112,7 @@
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>14.0.1</version> <version>19.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jolira</groupId> <groupId>com.jolira</groupId>
@ -126,14 +127,14 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>5.9</version> <version>${com.puppycrawl.tools.checkstyle.version}</version>
</dependency> </dependency>
<!-- CDI, Weld, Arquillian --> <!-- CDI, Weld, Arquillian -->
<dependency> <dependency>
<groupId>javax.enterprise</groupId> <groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId> <artifactId>cdi-api</artifactId>
<version>1.0-SP4</version> <version>1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.inject</groupId> <groupId>javax.inject</groupId>
@ -155,7 +156,7 @@
<dependency> <dependency>
<groupId>org.jboss.weld</groupId> <groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId> <artifactId>weld-core</artifactId>
<version>1.1.13.Final</version> <version>2.3.2.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish</groupId> <groupId>org.glassfish</groupId>
@ -284,6 +285,11 @@
<artifactId>mapstruct-build-config</artifactId> <artifactId>mapstruct-build-config</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${com.puppycrawl.tools.checkstyle.version}</version>
</dependency>
</dependencies> </dependencies>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -131,7 +131,7 @@ public class Decorator extends GeneratedType {
elementPackage, elementPackage,
mapperElement.getKind() == ElementKind.INTERFACE ? mapperElement.getSimpleName().toString() : null, mapperElement.getKind() == ElementKind.INTERFACE ? mapperElement.getSimpleName().toString() : null,
methods, methods,
Arrays.asList( new Field( typeFactory.getType( mapperElement ), "delegate", true ) ) , Arrays.asList( new Field( typeFactory.getType( mapperElement ), "delegate", true ) ),
options, options,
versionInformation, versionInformation,
Accessibility.fromModifiers( mapperElement.getModifiers() ), Accessibility.fromModifiers( mapperElement.getModifiers() ),

View File

@ -63,7 +63,7 @@ public class NestedPropertyMappingMethod extends MappingMethod {
} }
List<SafePropertyEntry> safePropertyEntries = new ArrayList<SafePropertyEntry>(); List<SafePropertyEntry> safePropertyEntries = new ArrayList<SafePropertyEntry>();
for ( PropertyEntry propertyEntry : propertyEntries ) { for ( PropertyEntry propertyEntry : propertyEntries ) {
String safeName = Strings.getSaveVariableName( propertyEntry.getName(), existingVariableNames); String safeName = Strings.getSaveVariableName( propertyEntry.getName(), existingVariableNames );
safePropertyEntries.add( new SafePropertyEntry( propertyEntry, safeName ) ); safePropertyEntries.add( new SafePropertyEntry( propertyEntry, safeName ) );
existingVariableNames.add( safeName ); existingVariableNames.add( safeName );
} }

View File

@ -30,7 +30,7 @@ import org.mapstruct.ap.internal.model.common.Type;
*/ */
public interface Assignment { public interface Assignment {
public static enum AssignmentType { enum AssignmentType {
/** assignment is direct */ /** assignment is direct */
DIRECT, DIRECT,
/** assignment is type converted */ /** assignment is type converted */

View File

@ -32,7 +32,7 @@ public enum Accessibility {
private final String keyword; private final String keyword;
private Accessibility(String keyword) { Accessibility(String keyword) {
this.keyword = keyword; this.keyword = keyword;
} }

View File

@ -44,7 +44,7 @@ class Node {
*/ */
private final Set<String> allDescendants; private final Set<String> allDescendants;
public Node(String name) { Node(String name) {
this.name = name; this.name = name;
descendants = new ArrayList<Node>(); descendants = new ArrayList<Node>();
allDescendants = new HashSet<String>(); allDescendants = new HashSet<String>();

View File

@ -37,7 +37,7 @@ public enum ReportingPolicy {
private final boolean requiresReport; private final boolean requiresReport;
private final boolean failsBuild; private final boolean failsBuild;
private ReportingPolicy(Diagnostic.Kind diagnosticKind, boolean requiresReport, boolean failsBuild) { ReportingPolicy(Diagnostic.Kind diagnosticKind, boolean requiresReport, boolean failsBuild) {
this.requiresReport = requiresReport; this.requiresReport = requiresReport;
this.diagnosticKind = diagnosticKind; this.diagnosticKind = diagnosticKind;
this.failsBuild = failsBuild; this.failsBuild = failsBuild;

View File

@ -59,7 +59,7 @@ public class FreeMarkerModelElementWriter {
private final BeanModel object; private final BeanModel object;
private final SimpleMapModel extParams; private final SimpleMapModel extParams;
public ExternalParamsTemplateModel(BeanModel object, SimpleMapModel extParams) { ExternalParamsTemplateModel(BeanModel object, SimpleMapModel extParams) {
this.object = object; this.object = object;
this.extParams = extParams; this.extParams = extParams;
} }

View File

@ -84,7 +84,7 @@
<#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true> <#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true>
<#list thrownTypes as exceptionType> <#list thrownTypes as exceptionType>
<@includeModel object=exceptionType/> <@includeModel object=exceptionType/>
<#if exceptionType_has_next>, </#if> <#if exceptionType_has_next>, </#if><#t>
</#list> </#list>
</@compress> </@compress>
</#macro> </#macro>

View File

@ -27,7 +27,7 @@ public <@includeModel object=returnType/> ${name}(<#list parameters as param><@i
<#if (thrownTypes?size > 0)>throws </#if> <#if (thrownTypes?size > 0)>throws </#if>
<#list thrownTypes as exceptionType> <#list thrownTypes as exceptionType>
<@includeModel object=exceptionType/> <@includeModel object=exceptionType/>
<#if exceptionType_has_next>, </#if> <#if exceptionType_has_next>, </#if><#t>
</#list> </#list>
</@compress> </@compress>
</#macro> </#macro>

View File

@ -101,7 +101,7 @@
<#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true> <#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true>
<#list thrownTypes as exceptionType> <#list thrownTypes as exceptionType>
<@includeModel object=exceptionType/> <@includeModel object=exceptionType/>
<#if exceptionType_has_next>, </#if> <#if exceptionType_has_next>, </#if><#t>
</#list> </#list>
</@compress> </@compress>
</#macro> </#macro>

View File

@ -78,7 +78,7 @@
<#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true> <#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true>
<#list thrownTypes as exceptionType> <#list thrownTypes as exceptionType>
<@includeModel object=exceptionType/> <@includeModel object=exceptionType/>
<#if exceptionType_has_next>, </#if> <#if exceptionType_has_next>, </#if><#t>
</#list> </#list>
</@compress> </@compress>
</#macro> </#macro>

View File

@ -35,16 +35,16 @@
<#list parameters as param> <#list parameters as param>
<#if param.targetType> <#if param.targetType>
<#-- a class is passed on for casting, see @TargetType --> <#-- a class is passed on for casting, see @TargetType -->
<@includeModel object=ext.targetType raw=true/>.class <@includeModel object=ext.targetType raw=true/>.class<#t>
<#elseif param.mappingTarget> <#elseif param.mappingTarget>
${ext.targetBeanName}.${ext.targetReadAccessorName}() ${ext.targetBeanName}.${ext.targetReadAccessorName}()
<#else> <#else>
<@_assignment/> <@_assignment/>
</#if> </#if>
<#if param_has_next>, </#if> <#if param_has_next>, </#if><#t>
</#list> </#list>
<#-- context parameter, e.g. for builtin methods concerning date conversion --> <#-- context parameter, e.g. for builtin methods concerning date conversion -->
<#if contextParam??>, ${contextParam}</#if> <#if contextParam??>, ${contextParam}</#if><#t>
</#macro> </#macro>
<#macro _assignment> <#macro _assignment>
<@includeModel object=assignment <@includeModel object=assignment

View File

@ -46,7 +46,7 @@ public class ArrayMappingTest {
assertThat( dto ).isNotNull(); assertThat( dto ).isNotNull();
assertThat( dto ).isNotEqualTo( source ); assertThat( dto ).isNotEqualTo( source );
assertThat( dto.getPublications() ).containsOnly( "the Lancet", "Nature"); assertThat( dto.getPublications() ).containsOnly( "the Lancet", "Nature" );
} }
@Test @Test

View File

@ -237,7 +237,7 @@ public class BuiltInTest {
DateProperty target = CalendarToDateMapper.INSTANCE.map( source ); DateProperty target = CalendarToDateMapper.INSTANCE.map( source );
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();
assertThat( target.getProp() ).isNotNull(); assertThat( target.getProp() ).isNotNull();
assertThat( target.getProp()).isEqualTo( createCalendar( "02.03.1999" ).getTime()); assertThat( target.getProp() ).isEqualTo( createCalendar( "02.03.1999" ).getTime() );
} }
@Test @Test
@ -250,7 +250,7 @@ public class BuiltInTest {
CalendarProperty target = DateToCalendarMapper.INSTANCE.map( source ); CalendarProperty target = DateToCalendarMapper.INSTANCE.map( source );
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();
assertThat( target.getProp() ).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 ); StringProperty target = CalendarToStringMapper.INSTANCE.map( source );
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();
assertThat( target.getProp() ).isNotNull(); assertThat( target.getProp() ).isNotNull();
assertThat( target.getProp()).isEqualTo( "02.03.1999" ); assertThat( target.getProp() ).isEqualTo( "02.03.1999" );
} }
@Test @Test
@ -277,7 +277,7 @@ public class BuiltInTest {
CalendarProperty target = StringToCalendarMapper.INSTANCE.map( source ); CalendarProperty target = StringToCalendarMapper.INSTANCE.map( source );
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();
assertThat( target.getProp() ).isNotNull(); assertThat( target.getProp() ).isNotNull();
assertThat( target.getProp()).isEqualTo( createCalendar( "02.03.1999" ) ); assertThat( target.getProp() ).isEqualTo( createCalendar( "02.03.1999" ) );
} }

View File

@ -52,7 +52,7 @@ public class MappingResultPostprocessorTest {
// setup // setup
Address address = new Address(); Address address = new Address();
address.setAddressLine( "RoadToNowhere;5"); address.setAddressLine( "RoadToNowhere;5" );
address.setTown( "SmallTown" ); address.setTown( "SmallTown" );
Employee employee = new Employee(); Employee employee = new Employee();
employee.setAddress( address ); employee.setAddress( address );

View File

@ -51,7 +51,7 @@ public class CollectionMappingTest {
public void shouldForgeNewIterableMappingMethod() { public void shouldForgeNewIterableMappingMethod() {
Source source = new Source(); Source source = new Source();
source.setFooSet( Collections.asSet( "1", "2") ); source.setFooSet( Collections.asSet( "1", "2" ) );
Target target = CollectionMapper.INSTANCE.sourceToTarget( source ); Target target = CollectionMapper.INSTANCE.sourceToTarget( source );
assertThat( target ).isNotNull(); assertThat( target ).isNotNull();

View File

@ -106,7 +106,7 @@ public class NestedMappingMethodInvocationTest {
assertThat( source ).isNotNull(); assertThat( source ).isNotNull();
assertThat( source.getDate().getValue() ).isEqualTo( "06.07.2013" ); 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 { private OrderType createOrderType() throws DatatypeConfigurationException {

View File

@ -139,7 +139,7 @@ public class QualifierTest {
GermanRelease result = MapperWithoutQualifiedBy.INSTANCE.map( foreignMovies ); GermanRelease result = MapperWithoutQualifiedBy.INSTANCE.map( foreignMovies );
assertThat( result ).isNotNull(); assertThat( result ).isNotNull();
assertThat( result.getTitle() ).isEqualTo( "ehT ,esneS htxiS"); assertThat( result.getTitle() ).isEqualTo( "ehT ,esneS htxiS" );
} }

View File

@ -60,7 +60,7 @@ public class JavaExpressionTest {
@Test @Test
@WithClasses({ @WithClasses({
Source.class, Source.class,
Source2.class , Source2.class,
Target.class, Target.class,
TimeAndFormat.class, TimeAndFormat.class,
SourceTargetMapperSeveralSources.class SourceTargetMapperSeveralSources.class

View File

@ -76,7 +76,7 @@ public class UpdateMethodsTest {
assertThat( organizationEntity.getCompany() ).isEqualTo( companyEntity ); assertThat( organizationEntity.getCompany() ).isEqualTo( companyEntity );
assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" ); assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" );
assertThat( organizationEntity.getType().getType() ).isEqualTo( "commercial" ); 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" ); assertThat( organizationEntity.getCompany().getDepartment().getName() ).isEqualTo( "finance" );
} }
@ -124,7 +124,7 @@ public class UpdateMethodsTest {
assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" ); assertThat( organizationEntity.getCompany().getName() ).isEqualTo( "PepsiCo" );
assertThat( organizationEntity.getType().getType() ).isEqualTo( "commercial" ); 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" ); assertThat( organizationEntity.getCompany().getDepartment().getName() ).isEqualTo( "finance" );
} }

View File

@ -57,7 +57,8 @@ public class ExternalHandWrittenMapper {
if ( entityMap != null && dtoMap != null ) { if ( entityMap != null && dtoMap != null ) {
for ( Map.Entry<SecretaryDto, EmployeeDto> dtoEntry : dtoMap.entrySet() ) { for ( Map.Entry<SecretaryDto, EmployeeDto> dtoEntry : dtoMap.entrySet() ) {
entityMap.put( DepartmentMapper.INSTANCE.toSecretaryEntity( dtoEntry.getKey() ) , entityMap.put(
DepartmentMapper.INSTANCE.toSecretaryEntity( dtoEntry.getKey() ),
DepartmentMapper.INSTANCE.toEmployeeEntity( dtoEntry.getValue() ) ); DepartmentMapper.INSTANCE.toEmployeeEntity( dtoEntry.getValue() ) );
} }
} }

View File

@ -98,7 +98,7 @@ public class ModifiableURLClassLoader extends URLClassLoader {
private static final class FilteringParentClassLoader extends ClassLoader { private static final class FilteringParentClassLoader extends ClassLoader {
private String excludedPackage; private String excludedPackage;
public FilteringParentClassLoader(String excludedPackage) { FilteringParentClassLoader(String excludedPackage) {
this.excludedPackage = excludedPackage; this.excludedPackage = excludedPackage;
} }