mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#81 Formatting
This commit is contained in:
parent
4bd1022b89
commit
f122daec6d
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.AnnotationValue;
|
||||
import javax.lang.model.element.Element;
|
||||
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.Modifier;
|
||||
|
||||
@ -89,8 +88,6 @@ public class Method {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Method(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType,
|
||||
Map<String, List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping) {
|
||||
this.declaringMapper = declaringMapper;
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.model.source;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.TypeParameterElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
@ -19,7 +19,6 @@
|
||||
package org.mapstruct.ap.processor;
|
||||
|
||||
import java.util.ListIterator;
|
||||
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import org.mapstruct.ap.model.Annotation;
|
||||
|
@ -27,6 +27,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.processing.Messager;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
@ -243,7 +244,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
|
||||
messager.printMessage(
|
||||
Kind.ERROR,
|
||||
String.format(
|
||||
"Ambigious factory method: \"%s\" conflicts with \"%s\".",
|
||||
"Ambigious factory methods: \"%s\" conflicts with \"%s\".",
|
||||
result,
|
||||
method
|
||||
),
|
||||
@ -690,8 +691,10 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
|
||||
}
|
||||
|
||||
MethodReference factoryMethod = getFactoryMethod( mapperReferences, methods, method.getReturnType() );
|
||||
return new MapMappingMethod( method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion,
|
||||
factoryMethod );
|
||||
return new MapMappingMethod(
|
||||
method, keyMappingMethod, keyConversion, valueMappingMethod, valueConversion,
|
||||
factoryMethod
|
||||
);
|
||||
}
|
||||
|
||||
private TypeConversion getConversion(Type sourceType, Type targetType, String dateFormat, String sourceReference) {
|
||||
|
@ -18,13 +18,10 @@
|
||||
*/
|
||||
package org.mapstruct.ap.processor;
|
||||
|
||||
import static javax.lang.model.util.ElementFilter.methodsIn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.processing.Messager;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
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.util.AnnotationProcessingException;
|
||||
|
||||
import static javax.lang.model.util.ElementFilter.methodsIn;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Bar {
|
||||
private String prop;
|
||||
|
@ -19,7 +19,6 @@
|
||||
package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
|
||||
|
||||
import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.a.BarFactory;
|
||||
|
||||
import org.mapstruct.ap.testutil.IssueKey;
|
||||
import org.mapstruct.ap.testutil.MapperTestBase;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
@ -30,11 +29,12 @@ import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
@IssueKey("81")
|
||||
@WithClasses( { Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class,
|
||||
Target.class } )
|
||||
@WithClasses({
|
||||
Bar.class, Foo.class, BarFactory.class, Source.class, SourceTargetMapperAndBarFactory.class,
|
||||
Target.class
|
||||
})
|
||||
public class FactoryTest extends MapperTestBase {
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ public class FactoryTest extends MapperTestBase {
|
||||
diagnostics = {
|
||||
@Diagnostic(type = BarFactory.class,
|
||||
kind = javax.tools.Diagnostic.Kind.ERROR,
|
||||
line = 30,
|
||||
messageRegExp = "^Ambigious factory method: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\."
|
||||
line = 29,
|
||||
messageRegExp = "^Ambigious factory methods: \"org\\.mapstruct\\.ap\\.test\\.erroneous\\."
|
||||
+ "ambiguousfactorymethod\\.Bar createBar\\(\\)\" conflicts with "
|
||||
+ "\"org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod\\.Bar "
|
||||
+ "org\\.mapstruct\\.ap\\.test\\.erroneous\\.ambiguousfactorymethod"
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Foo {
|
||||
private String prop;
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Source {
|
||||
|
||||
|
@ -24,7 +24,6 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
@Mapper(uses = BarFactory.class)
|
||||
public abstract class SourceTargetMapperAndBarFactory {
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.erroneous.ambiguousfactorymethod;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Target {
|
||||
|
||||
|
@ -22,7 +22,6 @@ import org.mapstruct.ap.test.erroneous.ambiguousfactorymethod.Bar;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class BarFactory {
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Bar1 {
|
||||
private String prop;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Bar2 {
|
||||
private String prop;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Bar3 {
|
||||
private String prop;
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public interface CustomList<T> extends List<T> {
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class CustomListImpl<T> extends LinkedList<T> implements CustomList<T> {
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public interface CustomMap<K, V> extends Map<K, V> {
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class CustomMapImpl<K, V> extends HashMap<K, V> implements CustomMap<K, V> {
|
||||
|
@ -22,22 +22,24 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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.MapperTestBase;
|
||||
import org.mapstruct.ap.testutil.WithClasses;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
@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,
|
||||
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 {
|
||||
@Test
|
||||
public void shouldUseTwoFactoryMethods() {
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Foo1 {
|
||||
private String prop;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Foo2 {
|
||||
private String prop;
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Foo3 {
|
||||
private String prop;
|
||||
|
@ -23,7 +23,6 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Source {
|
||||
|
||||
|
@ -20,13 +20,13 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.mapstruct.ap.test.factories.a.BarFactory;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ap.test.factories.a.BarFactory;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
@Mapper(uses = { BarFactory.class, org.mapstruct.ap.test.factories.b.BarFactory.class })
|
||||
public abstract class SourceTargetMapperAndBar2Factory {
|
||||
|
@ -20,7 +20,6 @@ package org.mapstruct.ap.test.factories;
|
||||
|
||||
/**
|
||||
* @author Sjaak Derksen
|
||||
*
|
||||
*/
|
||||
public class Target {
|
||||
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories.a;
|
||||
import org.mapstruct.ap.test.factories.Bar1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class BarFactory {
|
||||
|
@ -21,7 +21,6 @@ package org.mapstruct.ap.test.factories.b;
|
||||
import org.mapstruct.ap.test.factories.Bar3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public class BarFactory {
|
||||
|
Loading…
x
Reference in New Issue
Block a user