#2614 Do not use FQN when mapping Stream to Array

This commit is contained in:
Filip Hrisafov 2021-10-16 22:00:30 +02:00
parent e86c0faf04
commit 935c03e822
3 changed files with 8 additions and 5 deletions

View File

@ -444,8 +444,11 @@ public class Type extends ModelElement implements Comparable<Type> {
}
private boolean shouldUseSimpleName() {
String fqn = notToBeImportedTypes.get( name );
return this.qualifiedName.equals( fqn );
// Using trimSimpleClassName since the same is used in the isToBeImported()
// to check whether notToBeImportedTypes contains it
String trimmedName = trimSimpleClassName( name );
String fqn = notToBeImportedTypes.get( trimmedName );
return trimSimpleClassName( this.qualifiedName ).equals( fqn );
}
public Type erasure() {

View File

@ -55,7 +55,7 @@
<#if needVarDefine>
<#assign needVarDefine = false />
<#-- We create a null array which later will be directly assigned from the stream-->
${resultElementType}[] ${resultName} = null;
<@includeModel object=resultElementType/>[] ${resultName} = null;
</#if>
<#elseif resultType.iterableType>
<#if existingInstanceMapping>

View File

@ -36,12 +36,12 @@ public class ConverterImpl extends Converter {
}
@Override
public org.mapstruct.ap.test.bugs._1707.Converter.Target[] convertArray(Stream<Source> source) {
public Target[] convertArray(Stream<Source> source) {
if ( source == null ) {
return null;
}
org.mapstruct.ap.test.bugs._1707.Converter.Target[] targetTmp = null;
Target[] targetTmp = null;
targetTmp = source.map( source1 -> convert( source1 ) )
.toArray( Target[]::new );