From 78b094395312e07e14aaf2a57bf084a6f3f40ca0 Mon Sep 17 00:00:00 2001 From: Gunnar Morling Date: Wed, 29 Jan 2014 00:35:26 +0100 Subject: [PATCH] #112 Making sure mapper references have unique variable names and referenced methods are invoked on the right variable --- .../ap/model/AnnotationMapperReference.java | 18 +--- .../ap/model/DefaultMapperReference.java | 33 +++---- .../mapstruct/ap/model/MapperReference.java | 21 ++++- .../ap/model/MappingMethodReference.java | 12 ++- ...nnotationBasedComponentModelProcessor.java | 5 +- .../ap/processor/MapperCreationProcessor.java | 90 +++++++++++++------ .../samename/Jsr330SourceTargetMapper.java | 39 ++++++++ ...ferencedMappersWithSameSimpleNameTest.java | 53 +++++++++++ .../ap/test/references/samename/Source.java | 41 +++++++++ .../samename/SourceTargetMapper.java | 37 ++++++++ .../ap/test/references/samename/Target.java | 41 +++++++++ .../references/samename/a/CustomMapper.java | 26 ++++++ .../references/samename/b/CustomMapper.java | 26 ++++++ 13 files changed, 374 insertions(+), 68 deletions(-) create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/Jsr330SourceTargetMapper.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/SeveralReferencedMappersWithSameSimpleNameTest.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/Source.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/SourceTargetMapper.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/Target.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/a/CustomMapper.java create mode 100644 processor/src/test/java/org/mapstruct/ap/test/references/samename/b/CustomMapper.java diff --git a/processor/src/main/java/org/mapstruct/ap/model/AnnotationMapperReference.java b/processor/src/main/java/org/mapstruct/ap/model/AnnotationMapperReference.java index b0504b2f9..6d310e27f 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/AnnotationMapperReference.java +++ b/processor/src/main/java/org/mapstruct/ap/model/AnnotationMapperReference.java @@ -18,12 +18,10 @@ */ package org.mapstruct.ap.model; -import java.beans.Introspector; import java.util.Set; import org.mapstruct.ap.model.common.Type; import org.mapstruct.ap.util.Collections; -import org.mapstruct.ap.util.Strings; /** * Mapper reference which is retrieved via Annotation-based dependency injection. @@ -34,16 +32,10 @@ import org.mapstruct.ap.util.Strings; public class AnnotationMapperReference extends MapperReference { private final Annotation annotation; - private final Type type; - public AnnotationMapperReference(Annotation annotation, Type type) { + public AnnotationMapperReference(Type type, String variableName, Annotation annotation) { + super( type, variableName ); this.annotation = annotation; - this.type = type; - } - - @Override - public Type getMapperType() { - return type; } public Annotation getAnnotation() { @@ -52,10 +44,6 @@ public class AnnotationMapperReference extends MapperReference { @Override public Set getImportTypes() { - return Collections.asSet( annotation.getImportTypes(), type ); - } - - public String getVariableName() { - return Strings.getSaveVariableName( Introspector.decapitalize( type.getName() ) ); + return Collections.asSet( annotation.getImportTypes(), super.getMapperType() ); } } diff --git a/processor/src/main/java/org/mapstruct/ap/model/DefaultMapperReference.java b/processor/src/main/java/org/mapstruct/ap/model/DefaultMapperReference.java index 62c65d390..9d4659b54 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/DefaultMapperReference.java +++ b/processor/src/main/java/org/mapstruct/ap/model/DefaultMapperReference.java @@ -19,6 +19,7 @@ package org.mapstruct.ap.model; import java.beans.Introspector; +import java.util.List; import java.util.Set; import org.mapstruct.ap.model.common.Type; @@ -34,24 +35,28 @@ import org.mapstruct.ap.util.Strings; */ public class DefaultMapperReference extends MapperReference { - private final Type type; private final boolean isAnnotatedMapper; private final Set importTypes; - public DefaultMapperReference(Type type, boolean isAnnotatedMapper, TypeFactory typeFactory) { - this.type = type; - + private DefaultMapperReference(Type type, boolean isAnnotatedMapper, Set importTypes, String variableName) { + super( type, variableName ); this.isAnnotatedMapper = isAnnotatedMapper; - importTypes = Collections.asSet( type ); - - if ( isAnnotatedMapper() ) { - importTypes.add( typeFactory.getType( "org.mapstruct.factory.Mappers" ) ); - } + this.importTypes = importTypes; } - @Override - public Type getMapperType() { - return type; + public static DefaultMapperReference getInstance(Type type, boolean isAnnotatedMapper, TypeFactory typeFactory, + List otherMapperReferences) { + Set importTypes = Collections.asSet( type ); + if ( isAnnotatedMapper ) { + importTypes.add( typeFactory.getType( "org.mapstruct.factory.Mappers" ) ); + } + + String variableName = Strings.getSaveVariableName( + Introspector.decapitalize( type.getName() ), + otherMapperReferences + ); + + return new DefaultMapperReference( type, isAnnotatedMapper, importTypes, variableName ); } @Override @@ -59,10 +64,6 @@ public class DefaultMapperReference extends MapperReference { return importTypes; } - public String getVariableName() { - return Strings.getSaveVariableName( Introspector.decapitalize( type.getName() ) ); - } - public boolean isAnnotatedMapper() { return isAnnotatedMapper; } diff --git a/processor/src/main/java/org/mapstruct/ap/model/MapperReference.java b/processor/src/main/java/org/mapstruct/ap/model/MapperReference.java index bc5bb0e4d..2106676fe 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/MapperReference.java +++ b/processor/src/main/java/org/mapstruct/ap/model/MapperReference.java @@ -28,10 +28,29 @@ import org.mapstruct.ap.model.common.Type; */ public abstract class MapperReference extends ModelElement { + private final Type type; + private final String variableName; + + public MapperReference(Type type, String variableName) { + this.type = type; + this.variableName = variableName; + } + /** * Returns the type of the referenced mapper * * @return the type of the referenced mapper */ - public abstract Type getMapperType(); + public Type getMapperType() { + return type; + } + + /** + * Returns the variable name of this reference. + * + * @return the variable name of this reference + */ + public String getVariableName() { + return variableName; + } } diff --git a/processor/src/main/java/org/mapstruct/ap/model/MappingMethodReference.java b/processor/src/main/java/org/mapstruct/ap/model/MappingMethodReference.java index 64d54d3c4..1845ab33b 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/MappingMethodReference.java +++ b/processor/src/main/java/org/mapstruct/ap/model/MappingMethodReference.java @@ -18,13 +18,11 @@ */ package org.mapstruct.ap.model; -import java.beans.Introspector; import java.util.HashSet; import java.util.Set; import org.mapstruct.ap.model.common.Type; import org.mapstruct.ap.model.source.Method; -import org.mapstruct.ap.util.Strings; /** * Represents a reference to {@link MappingMethod}. @@ -33,19 +31,19 @@ import org.mapstruct.ap.util.Strings; */ public class MappingMethodReference extends MappingMethod { - private final Type declaringMapper; + private final MapperReference declaringMapper; - public MappingMethodReference(Method method) { + public MappingMethodReference(Method method, MapperReference declaringMapper) { super( method ); - this.declaringMapper = method.getDeclaringMapper(); + this.declaringMapper = declaringMapper; } - public Type getDeclaringMapper() { + public MapperReference getDeclaringMapper() { return declaringMapper; } public String getMapperVariableName() { - return Strings.getSaveVariableName( Introspector.decapitalize( declaringMapper.getName() ) ); + return declaringMapper.getVariableName(); } public Set getReferencedTypes() { diff --git a/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java index 065c35fa1..fdfd1a097 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/AnnotationBasedComponentModelProcessor.java @@ -75,8 +75,9 @@ public abstract class AnnotationBasedComponentModelProcessor implements ModelEle */ protected MapperReference replacementMapperReference(MapperReference originalReference) { return new AnnotationMapperReference( - getMapperReferenceAnnotation(), - originalReference.getMapperType() + originalReference.getMapperType(), + originalReference.getVariableName(), + getMapperReferenceAnnotation() ); } diff --git a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java index 8e45dfb9e..5980b3777 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java @@ -27,7 +27,6 @@ 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; @@ -103,8 +102,8 @@ public class MapperCreationProcessor implements ModelElementProcessor methods) { ReportingPolicy unmappedTargetPolicy = getEffectiveUnmappedTargetPolicy( element ); - List mappingMethods = getMappingMethods( methods, unmappedTargetPolicy ); List mapperReferences = getReferencedMappers( element ); + List mappingMethods = getMappingMethods( mapperReferences, methods, unmappedTargetPolicy ); return new Mapper.Builder() .element( element ) @@ -143,22 +142,27 @@ public class MapperCreationProcessor implements ModelElementProcessor getReferencedMappers(TypeElement element) { List mapperReferences = new LinkedList(); + List variableNames = new LinkedList(); + MapperPrism mapperPrism = MapperPrism.getInstanceOn( element ); for ( TypeMirror usedMapper : mapperPrism.uses() ) { - mapperReferences.add( - new DefaultMapperReference( - typeFactory.getType( usedMapper ), - MapperPrism.getInstanceOn( typeUtils.asElement( usedMapper ) ) != null, - typeFactory - ) + DefaultMapperReference mapperReference = DefaultMapperReference.getInstance( + typeFactory.getType( usedMapper ), + MapperPrism.getInstanceOn( typeUtils.asElement( usedMapper ) ) != null, + typeFactory, + variableNames ); + + mapperReferences.add( mapperReference ); + variableNames.add( mapperReference.getVariableName() ); } return mapperReferences; } - private List getMappingMethods(List methods, ReportingPolicy unmappedTargetPolicy) { + private List getMappingMethods(List mapperReferences, List methods, + ReportingPolicy unmappedTargetPolicy) { List mappingMethods = new ArrayList(); for ( Method method : methods ) { @@ -175,14 +179,14 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Method method, ExecutableElement targetAcessor, - Parameter parameter) { + private PropertyMapping getPropertyMapping(List mapperReferences, List methods, + Method method, ExecutableElement targetAcessor, Parameter parameter) { String targetPropertyName = Executables.getPropertyName( targetAcessor ); Mapping mapping = method.getMapping( targetPropertyName ); String dateFormat = mapping != null ? mapping.getDateFormat() : null; @@ -248,6 +257,7 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Method method, - ReportingPolicy unmappedTargetPolicy) { + private MappingMethod getBeanMappingMethod(List mapperReferences, List methods, + Method method, ReportingPolicy unmappedTargetPolicy) { List propertyMappings = new ArrayList(); Set mappedTargetProperties = new HashSet(); @@ -300,12 +311,13 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Method method, Parameter parameter, - ExecutableElement sourceAccessor, ExecutableElement targetAcessor, - String dateFormat) { + private PropertyMapping getPropertyMapping(List mapperReferences, List methods, + Method method, Parameter parameter, ExecutableElement sourceAccessor, + ExecutableElement targetAcessor, String dateFormat) { Type sourceType = typeFactory.getReturnType( sourceAccessor ); Type targetType = null; String conversionString = null; @@ -496,7 +508,12 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Method method) { + private MappingMethod getIterableMappingMethod(List mapperReferences, List methods, + Method method) { Type sourceElementType = method.getSourceParameters().iterator().next().getType().getTypeParameters().get( 0 ); Type targetElementType = method.getResultType().getTypeParameters().get( 0 ); @@ -539,7 +557,7 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Method method) { + private MappingMethod getMapMappingMethod(List mapperReferences, List methods, + Method method) { List sourceTypeParams = method.getSourceParameters().iterator().next().getType().getTypeParameters(); Type sourceKeyType = sourceTypeParams.get( 0 ); Type sourceValueType = sourceTypeParams.get( 1 ); @@ -581,8 +600,14 @@ public class MapperCreationProcessor implements ModelElementProcessor methods, Type parameterType, + private MappingMethodReference getMappingMethodReference(List mapperReferences, + Iterable methods, Type parameterType, Type returnType) { List candidatesWithMathingTargetType = new ArrayList(); @@ -678,7 +704,17 @@ public class MapperCreationProcessor implements ModelElementProcessor candidatesWithBestMathingType, int bestMatchingTypeDistance, diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/Jsr330SourceTargetMapper.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Jsr330SourceTargetMapper.java new file mode 100644 index 000000000..6c55d960a --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Jsr330SourceTargetMapper.java @@ -0,0 +1,39 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename; + +import org.mapstruct.Mapper; +import org.mapstruct.ap.test.references.samename.a.CustomMapper; +import org.mapstruct.factory.Mappers; + +/** + * @author Gunnar Morling + */ +@Mapper( + componentModel = "jsr330", + uses = { + CustomMapper.class, + org.mapstruct.ap.test.references.samename.b.CustomMapper.class + }) +public interface Jsr330SourceTargetMapper { + + Jsr330SourceTargetMapper INSTANCE = Mappers.getMapper( Jsr330SourceTargetMapper.class ); + + Target sourceToTarget(Source source); +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/SeveralReferencedMappersWithSameSimpleNameTest.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/SeveralReferencedMappersWithSameSimpleNameTest.java new file mode 100644 index 000000000..506497e0f --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/SeveralReferencedMappersWithSameSimpleNameTest.java @@ -0,0 +1,53 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename; + +import org.mapstruct.ap.test.references.samename.a.CustomMapper; +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; + +/** + * Test for referring several mappers with the same simple name. + * + * @author Gunnar Morling + */ +@IssueKey("112") +@WithClasses({ + Source.class, Target.class, SourceTargetMapper.class, CustomMapper.class, + org.mapstruct.ap.test.references.samename.b.CustomMapper.class, Jsr330SourceTargetMapper.class +}) +public class SeveralReferencedMappersWithSameSimpleNameTest extends MapperTestBase { + + @Test + public void severalMappersWithSameSimpleNameCanBeReferenced() { + Source source = new Source(); + source.setFoo( 123 ); + source.setBar( 456L ); + + Target target = SourceTargetMapper.INSTANCE.sourceToTarget( source ); + + assertThat( target ).isNotNull(); + assertThat( target.getFoo() ).isEqualTo( "246" ); + assertThat( target.getBar() ).isEqualTo( "912" ); + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/Source.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Source.java new file mode 100644 index 000000000..6d77eb400 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Source.java @@ -0,0 +1,41 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename; + +public class Source { + + private int foo; + private long bar; + + public int getFoo() { + return foo; + } + + public void setFoo(int foo) { + this.foo = foo; + } + + public long getBar() { + return bar; + } + + public void setBar(long bar) { + this.bar = bar; + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/SourceTargetMapper.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/SourceTargetMapper.java new file mode 100644 index 000000000..563fd8358 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/SourceTargetMapper.java @@ -0,0 +1,37 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename; + +import org.mapstruct.Mapper; +import org.mapstruct.ap.test.references.samename.a.CustomMapper; +import org.mapstruct.factory.Mappers; + +/** + * @author Gunnar Morling + */ +@Mapper(uses = { + CustomMapper.class, + org.mapstruct.ap.test.references.samename.b.CustomMapper.class +}) +public interface SourceTargetMapper { + + SourceTargetMapper INSTANCE = Mappers.getMapper( SourceTargetMapper.class ); + + Target sourceToTarget(Source source); +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/Target.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Target.java new file mode 100644 index 000000000..9ba9e9843 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/Target.java @@ -0,0 +1,41 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename; + +public class Target { + + private String foo; + private String bar; + + public String getFoo() { + return foo; + } + + public void setFoo(String foo) { + this.foo = foo; + } + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/a/CustomMapper.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/a/CustomMapper.java new file mode 100644 index 000000000..a9df82d1f --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/a/CustomMapper.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename.a; + +public class CustomMapper { + + public String intToString(int i) { + return String.valueOf( i * 2 ); + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/references/samename/b/CustomMapper.java b/processor/src/test/java/org/mapstruct/ap/test/references/samename/b/CustomMapper.java new file mode 100644 index 000000000..c9e50c09e --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/references/samename/b/CustomMapper.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.test.references.samename.b; + +public class CustomMapper { + + public String longToString(long l) { + return String.valueOf( l * 2 ); + } +}