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 @@ -614,11 +614,14 @@ public Type withoutBounds() {
* @return {@code true} if and only if this type is assignable to the given other type.
*/
public boolean isAssignableTo(Type other) {
TypeMirror otherMirror = other.typeMirror;
if ( otherMirror.getKind() == TypeKind.WILDCARD ) {
otherMirror = typeUtils.erasure( other.typeMirror );
}
if ( TypeKind.WILDCARD == typeMirror.getKind() ) {
return typeUtils.contains( typeMirror, other.typeMirror );
return typeUtils.contains( typeMirror, otherMirror );
}

return typeUtils.isAssignable( typeMirror, other.typeMirror );
return typeUtils.isAssignable( typeMirror, otherMirror );
}

/**
Expand Down
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 );
}
}
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() {
}
}
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;
}
}
}
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;
}
}
}