forked from mapstruct/mapstruct
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mapstruct#3163: Strip wild card when checking for type assignability
- Loading branch information
Showing
5 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
processor/src/test/java/org/mapstruct/ap/test/bugs/_3163/Issue3163Mapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._3163; | ||
|
||
import java.util.Optional; | ||
|
||
import org.mapstruct.Mapper; | ||
|
||
@Mapper | ||
public interface Issue3163Mapper { | ||
|
||
Target map(Source value); | ||
|
||
Target.Nested map(Source.Nested value); | ||
|
||
default <T> Optional<T> wrapAsOptional(T value) { | ||
return Optional.ofNullable( value ); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
processor/src/test/java/org/mapstruct/ap/test/bugs/_3163/Issue3163Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._3163; | ||
|
||
import org.mapstruct.ap.testutil.ProcessorTest; | ||
import org.mapstruct.ap.testutil.WithClasses; | ||
|
||
@WithClasses({ | ||
Issue3163Mapper.class, | ||
Source.class, | ||
Target.class | ||
}) | ||
class Issue3163Test { | ||
|
||
@ProcessorTest | ||
void shouldCompile() { | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
processor/src/test/java/org/mapstruct/ap/test/bugs/_3163/Source.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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._3163; | ||
|
||
/** | ||
* @author Filip Hrisafov | ||
*/ | ||
public class Source { | ||
|
||
private final Nested nested; | ||
|
||
public Source(Nested nested) { | ||
this.nested = nested; | ||
} | ||
|
||
public Nested getNested() { | ||
return nested; | ||
} | ||
|
||
public static class Nested { | ||
private final String value; | ||
|
||
public Nested(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
processor/src/test/java/org/mapstruct/ap/test/bugs/_3163/Target.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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._3163; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author Filip Hrisafov | ||
*/ | ||
public class Target { | ||
|
||
private Nested nested; | ||
|
||
public Optional<Nested> getNested() { | ||
return Optional.ofNullable( nested ); | ||
} | ||
|
||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") | ||
public final void setNested(Optional<? extends Nested> nested) { | ||
this.nested = nested.orElse( null ); | ||
} | ||
|
||
public static class Nested { | ||
|
||
private String value; | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
} | ||
} |