File tree Expand file tree Collapse file tree 3 files changed +65
-1
lines changed
main/resources/org/mapstruct/ap/internal/model
test/java/org/mapstruct/ap/test/bugs/_3110 Expand file tree Collapse file tree 3 files changed +65
-1
lines changed Original file line number Diff line number Diff line change 1010 <#nt ><@includeModel object=annotation/ >
1111</#list >
1212<#if overridden >@Override</#if >
13- <#lt >${accessibility.keyword} <@includeModel object=returnType/ > ${name} (<#list parameters as param ><@includeModel object=param/ ><#if param_has_next >, </#if ></#list >) {
13+ <#lt >${accessibility.keyword} <@includeModel object=returnType/ > ${name} (<#list parameters as param ><@includeModel object=param/ ><#if param_has_next >, </#if ></#list >)<@ throws/ > {
1414 <#list beforeMappingReferencesWithoutMappingTarget as callback >
1515 <@includeModel object=callback targetBeanName=resultName targetType=resultType/ >
1616 <#if !callback_has_next >
6969 </#if >
7070 </@compress >
7171</#macro >
72+ <#macro throws >
73+ <#if (thrownTypes?size > 0)><#lt > throws </#if ><@compress single_line=true >
74+ <#list thrownTypes as exceptionType >
75+ <@includeModel object=exceptionType/ >
76+ <#if exceptionType_has_next >, </#if ><#t >
77+ </#list >
78+ </@compress >
79+ </#macro >
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._3110 ;
7+
8+ import org .mapstruct .EnumMapping ;
9+ import org .mapstruct .Mapper ;
10+
11+ @ Mapper
12+ public interface Issue3110Mapper {
13+ enum SourceEnum {
14+ FOO , BAR
15+ }
16+
17+ enum TargetEnum {
18+ FOO , BAR
19+ }
20+
21+ class CustomCheckedException extends Exception {
22+ public CustomCheckedException (String message ) {
23+ super ( message );
24+ }
25+ }
26+
27+ @ EnumMapping (unexpectedValueMappingException = CustomCheckedException .class )
28+ TargetEnum map (SourceEnum sourceEnum ) throws CustomCheckedException ;
29+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._3110 ;
7+
8+ import org .junit .jupiter .api .extension .RegisterExtension ;
9+ import org .mapstruct .ap .testutil .IssueKey ;
10+ import org .mapstruct .ap .testutil .ProcessorTest ;
11+ import org .mapstruct .ap .testutil .WithClasses ;
12+ import org .mapstruct .ap .testutil .runner .GeneratedSource ;
13+
14+ @ WithClasses ({
15+ Issue3110Mapper .class
16+ })
17+ @ IssueKey ("3110" )
18+ class Issue3110MapperTest {
19+ @ RegisterExtension
20+ final GeneratedSource generatedSource = new GeneratedSource ();
21+
22+ @ ProcessorTest
23+ void throwsException () {
24+ generatedSource .forMapper ( Issue3110Mapper .class ).content ()
25+ .contains ( "throws CustomCheckedException" );
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments