diff --git a/processor/src/main/java/org/mapstruct/ap/internal/model/assignment/UpdateWrapper.java b/processor/src/main/java/org/mapstruct/ap/internal/model/assignment/UpdateWrapper.java index b14e63df1..c63b488c9 100644 --- a/processor/src/main/java/org/mapstruct/ap/internal/model/assignment/UpdateWrapper.java +++ b/processor/src/main/java/org/mapstruct/ap/internal/model/assignment/UpdateWrapper.java @@ -78,6 +78,7 @@ public class UpdateWrapper extends AssignmentWrapper { imported.addAll( super.getImportTypes() ); if ( targetImplementationType != null ) { imported.add( targetImplementationType ); + imported.addAll( targetImplementationType.getTypeParameters() ); } return imported; } diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CarMapper.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CarMapper.java new file mode 100644 index 000000000..afc8e16bc --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CarMapper.java @@ -0,0 +1,37 @@ +/** + * Copyright 2012-2016 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.bugs._955; + +import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; +import org.mapstruct.ap.test.bugs._955.dto.Car; +import org.mapstruct.ap.test.bugs._955.dto.SuperCar; +import org.mapstruct.factory.Mappers; + +/** + * + * @author Sjaak Derksen + */ +@Mapper(uses = {CustomMapper.class}) +public interface CarMapper { + + CarMapper INSTANCE = Mappers.getMapper( CarMapper.class ); + + SuperCar mapCar(Car source, @MappingTarget SuperCar destination); +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CustomMapper.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CustomMapper.java new file mode 100644 index 000000000..604061762 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/CustomMapper.java @@ -0,0 +1,34 @@ +/** + * Copyright 2012-2016 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.bugs._955; + +import java.util.Map; +import org.mapstruct.MappingTarget; +import org.mapstruct.ap.test.bugs._955.dto.Person; + +/** + * + * @author Sjaak Derksen + */ +public class CustomMapper { + + public Map merge(Map source, @MappingTarget Map destination) { + return destination; + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/Issue955Test.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/Issue955Test.java new file mode 100644 index 000000000..72b70a7e9 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/Issue955Test.java @@ -0,0 +1,41 @@ +/** + * Copyright 2012-2016 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.bugs._955; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mapstruct.ap.test.bugs._955.dto.Car; +import org.mapstruct.ap.test.bugs._955.dto.Person; +import org.mapstruct.ap.test.bugs._955.dto.SuperCar; +import org.mapstruct.ap.testutil.IssueKey; +import org.mapstruct.ap.testutil.WithClasses; +import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner; + +/** + * + * @author Sjaak Derksen + */ +@IssueKey( "955" ) +@RunWith(AnnotationProcessorTestRunner.class) +@WithClasses( { CarMapper.class, CustomMapper.class, Car.class, SuperCar.class, Person.class } ) +public class Issue955Test { + + @Test + public void shouldCompile() { } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Car.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Car.java new file mode 100644 index 000000000..3ebfd78b6 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Car.java @@ -0,0 +1,39 @@ +/** + * Copyright 2012-2016 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.bugs._955.dto; + +import java.util.HashMap; +import java.util.Map; + +/** + * + * @author Sjaak Derksen + */ +public class Car { + private Map persons = new HashMap(); + + public Map getPersons() { + return persons; + } + + public void setPersons(Map persons) { + this.persons = persons; + } + +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Person.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Person.java new file mode 100644 index 000000000..040eb2205 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/Person.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 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.bugs._955.dto; + +/** + * + * @author Sjaak Derksen + */ +public class Person { + +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/SuperCar.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/SuperCar.java new file mode 100644 index 000000000..bc2924b1a --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_955/dto/SuperCar.java @@ -0,0 +1,39 @@ +/** + * Copyright 2012-2016 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.bugs._955.dto; + +import java.util.HashMap; +import java.util.Map; + +/** + * + * @author Sjaak Derksen + */ +public class SuperCar { + private Map persons = new HashMap(); + + public Map getPersons() { + return persons; + } + + public void setPersons(Map persons) { + this.persons = persons; + } + +}