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 @@ -60,7 +60,8 @@
<#macro handleLocalVarNullCheck needs_explicit_local_var>
<#if sourcePresenceCheckerReference??>
if ( <@includeModel object=sourcePresenceCheckerReference
targetPropertyName=ext.targetPropertyName/> ) {
targetType=ext.targetType
targetPropertyName=ext.targetPropertyName /> ) {
<#if needs_explicit_local_var>
<@includeModel object=nullCheckLocalVarType/> ${nullCheckLocalVarName} = <@lib.handleAssignment/>;
<#nested>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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._2901;

import java.util.List;

import org.mapstruct.Condition;
import org.mapstruct.Mapper;
import org.mapstruct.TargetType;

@Mapper
public interface ConditionWithTargetTypeOnCollectionMapper {

Target map(Source source);

@Condition
default boolean check(List<String> test, @TargetType Class<?> type) {
return type.isInstance( test );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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._2901;

import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.ProcessorTest;
import org.mapstruct.ap.testutil.WithClasses;

/**
* @author Ben Zegveld
*/
@IssueKey( "2901" )
class Issue2901Test {

@ProcessorTest
@WithClasses( { Source.class, Target.class, ConditionWithTargetTypeOnCollectionMapper.class } )
void shouldCompile() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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._2901;

import java.util.List;

public class Source {

private List<String> field;

public List<String> getField() {
return field;
}

public void setField(List<String> field) {
this.field = field;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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._2901;

import java.util.List;

public class Target {

private List<Integer> field;

public List<Integer> getField() {
return field;
}

public void setField(List<Integer> field) {
this.field = field;
}
}