#81 Formatting

This commit is contained in:
Gunnar Morling 2014-02-09 11:21:52 +01:00
parent 4bd1022b89
commit f122daec6d
30 changed files with 94 additions and 116 deletions

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;

View File

@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -89,8 +88,6 @@ public class Method {
); );
} }
private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType, private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType,
Map<String, List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping) { Map<String, List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping) {
this.declaringMapper = declaringMapper; this.declaringMapper = declaringMapper;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.model.source;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.element.VariableElement; import javax.lang.model.element.VariableElement;

View File

@ -19,7 +19,6 @@
package org.mapstruct.ap.processor; package org.mapstruct.ap.processor;
import java.util.ListIterator; import java.util.ListIterator;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
import org.mapstruct.ap.model.Annotation; import org.mapstruct.ap.model.Annotation;

View File

@ -27,6 +27,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
@ -243,7 +244,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
messager.printMessage( messager.printMessage(
Kind.ERROR, Kind.ERROR,
String.format( String.format(
"Ambigious factory method: \"%s\" conflicts with \"%s\".", "Ambigious factory methods: \"%s\" conflicts with \"%s\".",
result, result,
method method
), ),
@ -690,8 +691,10 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
} }
MethodReference factoryMethod = getFactoryMethod( mapperReferences, methods, method.getReturnType() ); MethodReference factoryMethod = getFactoryMethod( mapperReferences, methods, method.getReturnType() );
return new MapMappingMethod( method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion, return new MapMappingMethod(
factoryMethod ); method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion,
factoryMethod
);
} }
private TypeConversion getConversion(Type sourceType, Type targetType, String dateFormat, String sourceReference) { private TypeConversion getConversion(Type sourceType, Type targetType, String dateFormat, String sourceReference) {

View File

@ -18,13 +18,10 @@
*/ */
package org.mapstruct.ap.processor; package org.mapstruct.ap.processor;
import static javax.lang.model.util.ElementFilter.methodsIn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
@ -48,6 +45,8 @@ import org.mapstruct.ap.prism.MappingPrism;
import org.mapstruct.ap.prism.MappingsPrism; import org.mapstruct.ap.prism.MappingsPrism;
import org.mapstruct.ap.util.AnnotationProcessingException; import org.mapstruct.ap.util.AnnotationProcessingException;
import static javax.lang.model.util.ElementFilter.methodsIn;
/** /**
* A {@link ModelElementProcessor} which retrieves a list of {@link Method}s * A {@link ModelElementProcessor} which retrieves a list of {@link Method}s
* representing all the mapping methods of the given bean mapper type as well as * representing all the mapping methods of the given bean mapper type as well as

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar { public class Bar {
private String prop; private String prop;

View File

@ -19,7 +19,6 @@
package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod; package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.a.BarFactory; import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.a.BarFactory;
import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.MapperTestBase; import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
@ -30,11 +29,12 @@ import org.testng.annotations.Test;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@IssueKey("81") @IssueKey("81")
@WithClasses( { Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class, @WithClasses({
Target.class } ) Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class,
Target.class
})
public class FactoryTest extends MapperTestBase { public class FactoryTest extends MapperTestBase {
@ -45,8 +45,8 @@ public class FactoryTest extends MapperTestBase {
diagnostics = { diagnostics = {
@Diagnostic(type = BarFactory.class, @Diagnostic(type = BarFactory.class,
kind = javax.tools.Diagnostic.Kind.ERROR, kind = javax.tools.Diagnostic.Kind.ERROR,
line = 30, line = 29,
messageRegExp = "^Ambigious factory method: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\." messageRegExp = "^Ambigious factory methods: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\."
+ "ambiguousfactorymethod\\.Bar createBar\\(\\)\" conflicts with " + "ambiguousfactorymethod\\.Bar createBar\\(\\)\" conflicts with "
+ "\"org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod\\.Bar " + "\"org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod\\.Bar "
+ "org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod" + "org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod"

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo { public class Foo {
private String prop; private String prop;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Source { public class Source {

View File

@ -24,7 +24,6 @@ import org.mapstruct.factory.Mappers;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@Mapper(uses = BarFactory.class) @Mapper(uses = BarFactory.class)
public abstract class SourceTargetMapperAndBarFactory { public abstract class SourceTargetMapperAndBarFactory {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Target { public class Target {

View File

@ -22,7 +22,6 @@ import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.Bar;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar1 { public class Bar1 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar2 { public class Bar2 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Bar3 { public class Bar3 {
private String prop; private String prop;

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.List; import java.util.List;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public interface CustomList<T> extends List<T> { public interface CustomList<T> extends List<T> {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.LinkedList; import java.util.LinkedList;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class CustomListImpl<T> extends LinkedList<T> implements CustomList<T> { public class CustomListImpl<T> extends LinkedList<T> implements CustomList<T> {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.Map; import java.util.Map;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public interface CustomMap<K, V> extends Map<K, V> { public interface CustomMap<K, V> extends Map<K, V> {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
import java.util.HashMap; import java.util.HashMap;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class CustomMapImpl<K, V> extends HashMap<K, V> implements CustomMap<K, V> { public class CustomMapImpl<K, V> extends HashMap<K, V> implements CustomMap<K, V> {

View File

@ -22,22 +22,24 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.mapstruct.ap.test.factories.a.BarFactory;
import static org.fest.assertions.Assertions.assertThat;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.MapperTestBase; import org.mapstruct.ap.testutil.MapperTestBase;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.fest.assertions.Assertions.assertThat;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@IssueKey("81") @IssueKey("81")
@WithClasses( { Bar1.class, Foo1.class, Bar2.class, Foo2.class, Bar3.class, Foo3.class, BarFactory.class, @WithClasses({
Bar1.class, Foo1.class, Bar2.class, Foo2.class, Bar3.class, Foo3.class, BarFactory.class,
org.mapstruct.ap.test.factories.b.BarFactory.class, Source.class, SourceTargetMapperAndBar2Factory.class, org.mapstruct.ap.test.factories.b.BarFactory.class, Source.class, SourceTargetMapperAndBar2Factory.class,
Target.class, CustomList.class, CustomListImpl.class, CustomMap.class, CustomMapImpl.class } ) Target.class, CustomList.class, CustomListImpl.class, CustomMap.class, CustomMapImpl.class
})
public class FactoryTest extends MapperTestBase { public class FactoryTest extends MapperTestBase {
@Test @Test
public void shouldUseTwoFactoryMethods() { public void shouldUseTwoFactoryMethods() {

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo1 { public class Foo1 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo2 { public class Foo2 {
private String prop; private String prop;

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Foo3 { public class Foo3 {
private String prop; private String prop;

View File

@ -23,7 +23,6 @@ import java.util.Map;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Source { public class Source {

View File

@ -20,13 +20,13 @@ package org.mapstruct.ap.test.factories;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.ap.test.factories.a.BarFactory;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
@Mapper(uses = { BarFactory.class, org.mapstruct.ap.test.factories.b.BarFactory.class }) @Mapper(uses = { BarFactory.class, org.mapstruct.ap.test.factories.b.BarFactory.class })
public abstract class SourceTargetMapperAndBar2Factory { public abstract class SourceTargetMapperAndBar2Factory {

View File

@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
/** /**
* @author Sjaak Derksen * @author Sjaak Derksen
*
*/ */
public class Target { public class Target {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories.a;
import org.mapstruct.ap.test.factories.Bar1; import org.mapstruct.ap.test.factories.Bar1;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {

View File

@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories.b;
import org.mapstruct.ap.test.factories.Bar3; import org.mapstruct.ap.test.factories.Bar3;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class BarFactory { public class BarFactory {