File tree Expand file tree Collapse file tree
main/java/org/mapstruct/ap/internal/model
test/java/org/mapstruct/ap/test/bugs/_2001 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -288,8 +288,15 @@ private boolean needsImportDeclaration(Type typeToAdd) {
288288 }
289289
290290 if ( typeToAdd .getPackageName ().equals ( packageName ) ) {
291- if ( !typeToAdd .getTypeElement ().getNestingKind ().isNested () ) {
292- return false ;
291+ if ( typeToAdd .getTypeElement () != null ) {
292+ if ( !typeToAdd .getTypeElement ().getNestingKind ().isNested () ) {
293+ return false ;
294+ }
295+ }
296+ else if ( typeToAdd .getComponentType () != null ) {
297+ if ( !typeToAdd .getComponentType ().getTypeElement ().getNestingKind ().isNested () ) {
298+ return false ;
299+ }
293300 }
294301 }
295302 }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ import java .util .Set ;
9+
10+ /**
11+ * @author Filip Hrisafov
12+ */
13+ public
14+ class Entity {
15+
16+ private Set <EntityExtra > extras ;
17+
18+ public Set <EntityExtra > getExtras () {
19+ return extras ;
20+ }
21+
22+ public void setExtras (Set <EntityExtra > extras ) {
23+ this .extras = extras ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ /**
9+ * @author Filip Hrisafov
10+ */
11+ public
12+ class EntityExtra {
13+
14+ private String value ;
15+
16+ public String getValue () {
17+ return value ;
18+ }
19+
20+ public void setValue (String value ) {
21+ this .value = value ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ /**
9+ * @author Filip Hrisafov
10+ */
11+ public
12+ class Form {
13+
14+ private FormExtra [] extras ;
15+
16+ public FormExtra [] getExtras () {
17+ return extras ;
18+ }
19+
20+ public void setExtras (FormExtra [] extras ) {
21+ this .extras = extras ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ /**
9+ * @author Filip Hrisafov
10+ */
11+ public
12+ class FormExtra {
13+
14+ private String value ;
15+
16+ public String getValue () {
17+ return value ;
18+ }
19+
20+ public void setValue (String value ) {
21+ this .value = value ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ import org .mapstruct .Mapper ;
9+
10+ /**
11+ * @author Filip Hrisafov
12+ */
13+ @ Mapper
14+ public interface Issue2001Mapper {
15+
16+ Form map (Entity entity );
17+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright MapStruct Authors.
3+ *
4+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+ */
6+ package org .mapstruct .ap .test .bugs ._2001 ;
7+
8+ import org .junit .Test ;
9+ import org .junit .runner .RunWith ;
10+ import org .mapstruct .ap .testutil .IssueKey ;
11+ import org .mapstruct .ap .testutil .WithClasses ;
12+ import org .mapstruct .ap .testutil .runner .AnnotationProcessorTestRunner ;
13+
14+ /**
15+ * @author Filip Hrisafov
16+ */
17+ @ IssueKey ("2001" )
18+ @ RunWith ( AnnotationProcessorTestRunner .class )
19+ @ WithClasses ( {
20+ Entity .class ,
21+ EntityExtra .class ,
22+ Form .class ,
23+ FormExtra .class ,
24+ Issue2001Mapper .class
25+ } )
26+ public class Issue2001Test {
27+
28+ @ Test
29+ public void shouldCompile () {
30+
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments