#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() { private boolean shouldUseSimpleName() {
String fqn = notToBeImportedTypes.get( name ); // Using trimSimpleClassName since the same is used in the isToBeImported()
return this.qualifiedName.equals( fqn ); // to check whether notToBeImportedTypes contains it
String trimmedName = trimSimpleClassName( name );
String fqn = notToBeImportedTypes.get( trimmedName );
return trimSimpleClassName( this.qualifiedName ).equals( fqn );
} }
public Type erasure() { public Type erasure() {

View File

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

View File

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