mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#2614 Do not use FQN when mapping Stream to Array
This commit is contained in:
parent
e86c0faf04
commit
935c03e822
@ -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() {
|
||||||
|
@ -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>
|
||||||
|
@ -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 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user