diff --git a/core-common/src/main/java/org/mapstruct/Mapper.java b/core-common/src/main/java/org/mapstruct/Mapper.java
index 6fe6275b3..f41e63df4 100644
--- a/core-common/src/main/java/org/mapstruct/Mapper.java
+++ b/core-common/src/main/java/org/mapstruct/Mapper.java
@@ -159,4 +159,23 @@ public @interface Mapper {
* @return strategy how to do null checking
*/
NullValueCheckStrategy nullValueCheckStrategy() default ON_IMPLICIT_CONVERSION;
+
+ /**
+ * If MapStruct could not find another mapping method or apply an automatic conversion it will try to generate a
+ * sub-mapping method between the two beans. If this property is set to {@code true} MapStruct will not try to
+ * automatically generate sub-mapping methods.
+ *
+ * Can be configured by the {@link MapperConfig#disableSubMappingMethodsGeneration()} as well.
+ *
+ * Note: If you need to use {@code disableSubMappingMethodsGeneration} please contact the MapStruct team at
+ * mapstruct.org or
+ * github.com/mapstruct/mapstruct to share what problem you
+ * are facing with the automatic sub-mapping generation.
+ *
+ * @return whether the automatic generation of sub-mapping methods is disabled
+ *
+ * @since 1.2
+ */
+ boolean disableSubMappingMethodsGeneration() default false;
+
}
diff --git a/core-common/src/main/java/org/mapstruct/MapperConfig.java b/core-common/src/main/java/org/mapstruct/MapperConfig.java
index 6091b6d48..89db2bed5 100644
--- a/core-common/src/main/java/org/mapstruct/MapperConfig.java
+++ b/core-common/src/main/java/org/mapstruct/MapperConfig.java
@@ -146,4 +146,22 @@ public @interface MapperConfig {
* @return strategy how to do null checking
*/
NullValueCheckStrategy nullValueCheckStrategy() default ON_IMPLICIT_CONVERSION;
+
+ /**
+ * If MapStruct could not find another mapping method or apply an automatic conversion it will try to generate a
+ * sub-mapping method between the two beans. If this property is set to {@code true} MapStruct will not try to
+ * automatically generate sub-mapping methods.
+ *
+ * Can be overridden by {@link Mapper#disableSubMappingMethodsGeneration()}
+ *
+ * Note: If you need to use {@code disableSubMappingMethodsGeneration} please contact the MapStruct team at
+ * mapstruct.org or
+ * github.com/mapstruct/mapstruct to share what problem you
+ * are facing with the automatic sub-mapping generation.
+ *
+ * @return whether the automatic generation of sub-mapping methods is disabled
+ *
+ * @since 1.2
+ */
+ boolean disableSubMappingMethodsGeneration() default false;
}
diff --git a/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractBaseBuilder.java b/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractBaseBuilder.java
index 09c8d1e2c..8f11684ab 100644
--- a/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractBaseBuilder.java
+++ b/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractBaseBuilder.java
@@ -20,9 +20,12 @@ package org.mapstruct.ap.internal.model;
import org.mapstruct.ap.internal.model.assignment.Assignment;
import org.mapstruct.ap.internal.model.common.ParameterBinding;
+import org.mapstruct.ap.internal.model.common.Type;
import org.mapstruct.ap.internal.model.source.ForgedMethod;
import org.mapstruct.ap.internal.model.source.MappingMethodUtils;
import org.mapstruct.ap.internal.model.source.Method;
+import org.mapstruct.ap.internal.util.MapperConfiguration;
+import org.mapstruct.ap.internal.util.Message;
/**
* @author Filip Hrisafov
@@ -47,6 +50,11 @@ class AbstractBaseBuilder> {
return myself;
}
+ boolean isDisableSubMappingMethodsGeneration() {
+ MapperConfiguration configuration = MapperConfiguration.getInstanceOn( ctx.getMapperTypeElement() );
+ return configuration.isDisableSubMappingMethodsGeneration();
+ }
+
/**
* Creates a forged assignment from the provided {@code sourceRHS} and {@code forgedMethod}. If a mapping method
* for the {@code forgedMethod} already exists, then this method used for the assignment.
@@ -109,4 +117,26 @@ class AbstractBaseBuilder> {
return assignment;
}
+
+ /**
+ * Reports that a mapping could not be created.
+ *
+ * @param method the method that should be mapped
+ * @param sourceErrorMessagePart the error message part for the source
+ * @param sourceRHS the {@link SourceRHS}
+ * @param targetType the type of the target mapping
+ * @param targetPropertyName the name of the target property
+ */
+ void reportCannotCreateMapping(Method method, String sourceErrorMessagePart, SourceRHS sourceRHS, Type targetType,
+ String targetPropertyName) {
+ ctx.getMessager().printMessage(
+ method.getExecutable(),
+ Message.PROPERTYMAPPING_MAPPING_NOT_FOUND,
+ sourceErrorMessagePart,
+ targetType,
+ targetPropertyName,
+ targetType,
+ sourceRHS.getSourceType() /* original source type */
+ );
+ }
}
diff --git a/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractMappingMethodBuilder.java b/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractMappingMethodBuilder.java
index f28540834..943724dba 100644
--- a/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractMappingMethodBuilder.java
+++ b/processor/src/main/java/org/mapstruct/ap/internal/model/AbstractMappingMethodBuilder.java
@@ -45,6 +45,9 @@ public abstract class AbstractMappingMethodBuilder map(List source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoKeyMappingFoundDisabledAuto.java b/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoKeyMappingFoundDisabledAuto.java
new file mode 100644
index 000000000..c0cd8fcb7
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoKeyMappingFoundDisabledAuto.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2012-2017 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.collection.erroneous;
+
+import java.text.AttributedString;
+import java.util.Map;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousCollectionNoKeyMappingFoundDisabledAuto {
+
+ Map map(Map source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoValueMappingFoundDisabledAuto.java b/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoValueMappingFoundDisabledAuto.java
new file mode 100644
index 000000000..365c62a75
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/collection/erroneous/ErroneousCollectionNoValueMappingFoundDisabledAuto.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2012-2017 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.collection.erroneous;
+
+import java.text.AttributedString;
+import java.util.Map;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousCollectionNoValueMappingFoundDisabledAuto {
+
+ Map map(Map source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousListToStreamNoElementMappingFoundDisabledAuto.java b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousListToStreamNoElementMappingFoundDisabledAuto.java
new file mode 100644
index 000000000..157146ee9
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousListToStreamNoElementMappingFoundDisabledAuto.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2012-2017 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.java8stream.erroneous;
+
+import java.text.AttributedString;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousListToStreamNoElementMappingFoundDisabledAuto {
+
+ Stream mapCollectionToStream(List source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamMappingTest.java b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamMappingTest.java
index 093eb75c8..ae35c3973 100644
--- a/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamMappingTest.java
+++ b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamMappingTest.java
@@ -115,13 +115,30 @@ public class ErroneousStreamMappingTest {
@Diagnostic(type = ErroneousStreamToStreamNoElementMappingFound.class,
kind = Kind.ERROR,
line = 36,
- messageRegExp = "Can't map Stream element .*AttributedString attributedString\" to .*String string\"." +
- " Consider to declare/implement a mapping method: \".*String map(.*AttributedString value)")
+ messageRegExp = "Can't map Stream element \".*AttributedString attributedString\" to \".*String " +
+ "string\". Consider to declare/implement a mapping method: \".*String map(.*AttributedString " +
+ "value)")
}
)
public void shouldFailOnNoElementMappingFoundForStreamToStream() {
}
+ @Test
+ @IssueKey("993")
+ @WithClasses({ ErroneousStreamToStreamNoElementMappingFoundDisabledAuto.class })
+ @ExpectedCompilationOutcome(
+ value = CompilationResult.FAILED,
+ diagnostics = {
+ @Diagnostic(type = ErroneousStreamToStreamNoElementMappingFoundDisabledAuto.class,
+ kind = Kind.ERROR,
+ line = 32,
+ messageRegExp = "Can't map stream element \".*AttributedString\" to \".*String \". Consider to " +
+ "declare/implement a mapping method: \".*String map(.*AttributedString value)")
+ }
+ )
+ public void shouldFailOnNoElementMappingFoundForStreamToStreamWithDisabledAuto() {
+ }
+
@Test
@WithClasses({ ErroneousListToStreamNoElementMappingFound.class })
@ExpectedCompilationOutcome(
@@ -130,13 +147,30 @@ public class ErroneousStreamMappingTest {
@Diagnostic(type = ErroneousListToStreamNoElementMappingFound.class,
kind = Kind.ERROR,
line = 37,
- messageRegExp = "Can't map .*AttributedString attributedString\" to .*String string\". " +
- "Consider to declare/implement a mapping method: \".*String map(.*AttributedString value)")
+ messageRegExp =
+ "Can't map Stream element \".*AttributedString attributedString\" to \".*String string\". " +
+ "Consider to declare/implement a mapping method: \".*String map\\(.*AttributedString value\\)")
}
)
public void shouldFailOnNoElementMappingFoundForListToStream() {
}
+ @Test
+ @IssueKey("993")
+ @WithClasses({ ErroneousListToStreamNoElementMappingFoundDisabledAuto.class })
+ @ExpectedCompilationOutcome(
+ value = CompilationResult.FAILED,
+ diagnostics = {
+ @Diagnostic(type = ErroneousListToStreamNoElementMappingFoundDisabledAuto.class,
+ kind = Kind.ERROR,
+ line = 33,
+ messageRegExp = "Can't map stream element \".*AttributedString\" to \".*String \". Consider to " +
+ "declare/implement a mapping method: \".*String map\\(.*AttributedString value\\)")
+ }
+ )
+ public void shouldFailOnNoElementMappingFoundForListToStreamWithDisabledAuto() {
+ }
+
@Test
@WithClasses({ ErroneousStreamToListNoElementMappingFound.class })
@ExpectedCompilationOutcome(
@@ -145,10 +179,27 @@ public class ErroneousStreamMappingTest {
@Diagnostic(type = ErroneousStreamToListNoElementMappingFound.class,
kind = Kind.ERROR,
line = 37,
- messageRegExp = "Can't map Stream element .*AttributedString attributedString\" to .*String string\"." +
+ messageRegExp =
+ "Can't map Stream element \".*AttributedString attributedString\" to .*String string\"." +
" Consider to declare/implement a mapping method: \".*String map(.*AttributedString value)")
}
)
public void shouldFailOnNoElementMappingFoundForStreamToList() {
}
+
+ @Test
+ @IssueKey("993")
+ @WithClasses({ ErroneousStreamToListNoElementMappingFoundDisabledAuto.class })
+ @ExpectedCompilationOutcome(
+ value = CompilationResult.FAILED,
+ diagnostics = {
+ @Diagnostic(type = ErroneousStreamToListNoElementMappingFoundDisabledAuto.class,
+ kind = Kind.ERROR,
+ line = 33,
+ messageRegExp = "Can't map stream element \".*AttributedString\" to .*String \". Consider to " +
+ "declare/implement a mapping method: \".*String map(.*AttributedString value)")
+ }
+ )
+ public void shouldFailOnNoElementMappingFoundForStreamToListWithDisabledAuto() {
+ }
}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToListNoElementMappingFoundDisabledAuto.java b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToListNoElementMappingFoundDisabledAuto.java
new file mode 100644
index 000000000..a3c1c7e65
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToListNoElementMappingFoundDisabledAuto.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2012-2017 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.java8stream.erroneous;
+
+import java.text.AttributedString;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousStreamToListNoElementMappingFoundDisabledAuto {
+
+ List mapStreamToCollection(Stream source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToStreamNoElementMappingFoundDisabledAuto.java b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToStreamNoElementMappingFoundDisabledAuto.java
new file mode 100644
index 000000000..56efd7e33
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/java8stream/erroneous/ErroneousStreamToStreamNoElementMappingFoundDisabledAuto.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2012-2017 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.java8stream.erroneous;
+
+import java.text.AttributedString;
+import java.util.stream.Stream;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousStreamToStreamNoElementMappingFoundDisabledAuto {
+
+ Stream mapStreamToStream(Stream source);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisableConfig.java b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisableConfig.java
new file mode 100644
index 000000000..8c49d6090
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisableConfig.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2012-2017 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.nestedbeans;
+
+import org.mapstruct.MapperConfig;
+
+/**
+ * @author Filip Hrisafov
+ */
+@MapperConfig(disableSubMappingMethodsGeneration = true)
+public interface DisableConfig {
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisablingNestedSimpleBeansMappingTest.java b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisablingNestedSimpleBeansMappingTest.java
new file mode 100644
index 000000000..245293608
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/DisablingNestedSimpleBeansMappingTest.java
@@ -0,0 +1,73 @@
+/**
+ * Copyright 2012-2017 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.nestedbeans;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mapstruct.ap.testutil.WithClasses;
+import org.mapstruct.ap.testutil.compilation.annotation.CompilationResult;
+import org.mapstruct.ap.testutil.compilation.annotation.Diagnostic;
+import org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome;
+import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
+
+/**
+ * @author Filip Hrisafov
+ */
+@WithClasses({
+ House.class, HouseDto.class,
+ Wheel.class, WheelDto.class,
+ Roof.class, RoofDto.class,
+ RoofType.class, ExternalRoofType.class
+})
+@RunWith(AnnotationProcessorTestRunner.class)
+public class DisablingNestedSimpleBeansMappingTest {
+
+ @WithClasses({
+ ErroneousDisabledHouseMapper.class
+ })
+ @ExpectedCompilationOutcome(value = CompilationResult.FAILED,
+ diagnostics = {
+ @Diagnostic(type = ErroneousDisabledHouseMapper.class,
+ kind = javax.tools.Diagnostic.Kind.ERROR,
+ line = 29,
+ messageRegExp = "Can't map property \".*\\.Roof roof\" to \".*\\.RoofDto roof\"\\. Consider to " +
+ "declare/implement a mapping method: \".*\\.RoofDto map\\(.*\\.Roof value\\)\"\\."
+ )
+ })
+ @Test
+ public void shouldUseDisabledMethodGenerationOnMapper() throws Exception {
+ }
+
+ @WithClasses({
+ ErroneousDisabledViaConfigHouseMapper.class,
+ DisableConfig.class
+ })
+ @ExpectedCompilationOutcome(value = CompilationResult.FAILED,
+ diagnostics = {
+ @Diagnostic(type = ErroneousDisabledViaConfigHouseMapper.class,
+ kind = javax.tools.Diagnostic.Kind.ERROR,
+ line = 29,
+ messageRegExp = "Can't map property \".*\\.Roof roof\" to \".*\\.RoofDto roof\"\\. Consider to " +
+ "declare/implement a mapping method: \".*\\.RoofDto map\\(.*\\.Roof value\\)\"\\."
+ )
+ })
+ @Test
+ public void shouldUseDisabledMethodGenerationOnMapperConfig() throws Exception {
+ }
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledHouseMapper.java b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledHouseMapper.java
new file mode 100644
index 000000000..d5617b70f
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledHouseMapper.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2012-2017 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.nestedbeans;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(disableSubMappingMethodsGeneration = true)
+public interface ErroneousDisabledHouseMapper {
+
+ HouseDto houseToHouseDto(House house);
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledViaConfigHouseMapper.java b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledViaConfigHouseMapper.java
new file mode 100644
index 000000000..ff5ceabf3
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/nestedbeans/ErroneousDisabledViaConfigHouseMapper.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2012-2017 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.nestedbeans;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper(config = DisableConfig.class)
+public interface ErroneousDisabledViaConfigHouseMapper {
+
+ HouseDto houseToHouseDto(House house);
+}