Skip to content

Commit

Permalink
#1821 nullpointer due to @BeanMapping via inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaakd committed May 16, 2019
1 parent 648ebce commit 35f67f1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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._1821;

import org.mapstruct.BeanMapping;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface Issue1821Mapper {

Issue1821Mapper INSTANCE = Mappers.getMapper( Issue1821Mapper.class );

@BeanMapping( resultType = Target.class )
Target map(Source source);

@InheritConfiguration( name = "map" )
ExtendedTarget mapExtended(Source source);

class Target {
}

class ExtendedTarget extends Target {
}

class Source {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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._1821;

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;

@IssueKey("1797")
@RunWith( AnnotationProcessorTestRunner.class)
@WithClasses( Issue1821Mapper.class )
public class Issue1821Test {

@Test
public void shouldNotGiveNullPtr() {
Issue1821Mapper.INSTANCE.map( new Issue1821Mapper.Source() );
}

}

0 comments on commit 35f67f1

Please sign in to comment.