Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<#nt><@includeModel object=annotation/>
</#list>
<#if overridden>@Override</#if>
<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>) {
<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, </#if></#list>)<@throws/> {
<#list beforeMappingReferencesWithoutMappingTarget as callback>
<@includeModel object=callback targetBeanName=resultName targetType=resultType/>
<#if !callback_has_next>
Expand Down Expand Up @@ -69,3 +69,11 @@
</#if>
</@compress>
</#macro>
<#macro throws>
<#if (thrownTypes?size > 0)><#lt> throws </#if><@compress single_line=true>
<#list thrownTypes as exceptionType>
<@includeModel object=exceptionType/>
<#if exceptionType_has_next>, </#if><#t>
</#list>
</@compress>
</#macro>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.test.bugs._3110;

import org.mapstruct.EnumMapping;
import org.mapstruct.Mapper;

@Mapper
public interface Issue3110Mapper {
enum SourceEnum {
FOO, BAR
}

enum TargetEnum {
FOO, BAR
}

class CustomCheckedException extends Exception {
public CustomCheckedException(String message) {
super( message );
}
}

@EnumMapping(unexpectedValueMappingException = CustomCheckedException.class)
TargetEnum map(SourceEnum sourceEnum) throws CustomCheckedException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.test.bugs._3110;

import org.junit.jupiter.api.extension.RegisterExtension;
import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.ProcessorTest;
import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.GeneratedSource;

@WithClasses({
Issue3110Mapper.class
})
@IssueKey("3110")
class Issue3110MapperTest {
@RegisterExtension
final GeneratedSource generatedSource = new GeneratedSource();

@ProcessorTest
void throwsException() {
generatedSource.forMapper( Issue3110Mapper.class ).content()
.contains( "throws CustomCheckedException" );
}
}