This commit is contained in:
Sjaak Derksen 2020-06-14 21:04:31 +02:00 committed by GitHub
parent da37d40152
commit 29b82e772c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,45 @@
/*
* 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._2111;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import static java.util.Collections.singletonList;
@Mapper
public interface Issue2111Mapper {
@Mapping(target = "strs", source = "ex", qualifiedByName = "wrap")
DTO map(UseExample from);
@Named("wrap")
default String mapExample(Example ex) {
return ex.name;
}
@Named("wrap")
default <T> List<T> wrapInList(T t) {
return singletonList( t );
}
//CHECKSTYLE:OFF
class Example {
public String name;
}
class UseExample {
public Example ex;
}
class DTO {
public List<String> strs;
}
//CHECKSTYLE:ON
}

View File

@ -0,0 +1,26 @@
/*
* 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._2111;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
/**
* @author Sjaak Derksen
*/
@IssueKey("2111")
@RunWith( AnnotationProcessorTestRunner.class )
@WithClasses( Issue2111Mapper.class )
public class Issue2111Test {
@Test
public void shouldCompile() {
}
}