#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
*/
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}.

View File

@ -37,7 +37,7 @@
<properties>
<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-vendor></toolchain-jdk-vendor>
<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.springframework.version>4.0.3.RELEASE</org.springframework.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 />
<forkCount>1</forkCount>
</properties>
@ -111,7 +112,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.jolira</groupId>
@ -126,14 +127,14 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>5.9</version>
<version>${com.puppycrawl.tools.checkstyle.version}</version>
</dependency>
<!-- CDI, Weld, Arquillian -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP4</version>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
@ -155,7 +156,7 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.13.Final</version>
<version>2.3.2.Final</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
@ -269,7 +270,7 @@
<failsOnError>true</failsOnError>
<violationSeverity>error</violationSeverity>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<propertyExpansion>basedir=${basedir}</propertyExpansion>
<propertyExpansion>basedir=${basedir}</propertyExpansion>
<!--
Excluding generated sources; Not required for the Maven build, but the Eclipse CS plug-in
would check the generated files without these exclusions; Note that the exclusions must be
@ -284,6 +285,11 @@
<artifactId>mapstruct-build-config</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${com.puppycrawl.tools.checkstyle.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ public enum ReportingPolicy {
private final boolean requiresReport;
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.diagnosticKind = diagnosticKind;
this.failsBuild = failsBuild;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,16 +35,16 @@
<#list parameters as param>
<#if param.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>
${ext.targetBeanName}.${ext.targetReadAccessorName}()
<#else>
<@_assignment/>
</#if>
<#if param_has_next>, </#if>
<#if param_has_next>, </#if><#t>
</#list>
<#-- context parameter, e.g. for builtin methods concerning date conversion -->
<#if contextParam??>, ${contextParam}</#if>
<#if contextParam??>, ${contextParam}</#if><#t>
</#macro>
<#macro _assignment>
<@includeModel object=assignment

View File

@ -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

View File

@ -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" ) );
}

View File

@ -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 );

View File

@ -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();

View File

@ -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 {

View File

@ -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" );
}

View File

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

View File

@ -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" );
}

View File

@ -57,7 +57,8 @@ public class ExternalHandWrittenMapper {
if ( entityMap != null && dtoMap != null ) {
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() ) );
}
}

View File

@ -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;
}